Webdriver | Launch Headless Browser Using Testmate | PhantomJS

A headless browser is a web browser without a graphical user interface. Headless browsers provide automated control of a web page in an environment similar to popular web browsers. PhantomJS is a headless WebKit scriptable with a JavaScript API. The Testmate code to execute it is as below:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
'Initialize the driver
 wd.PJSInitializeDriver("C:\Users\...\Driverpath")
 
'wd.NavigateToUrl("www.google.com")
 Call wd.NavigateToUrl("https://jqueryui.com/droppable/")
 
'Switch to the frame using xpath as identifier
 Call wd.SwitchToFrame("xpath::.//*[@id='content']/iframe")
 
'Initialize Action object
 Call wd.ActionInitialize()
 
'Add an action to the initialized action object
 Call wd.ActionDragAndDrop("id::draggable","id::droppable")
 
'Perform the action
 Call wd.ActionPerform()
 
'Report the step
 Logger.Pass "Step 1", wd.GetTitle(), True
 
'Quit The driver
 Call wd.Quit()

Add a Comment

Your email address will not be published. Required fields are marked *