March 19, 2018
Webdriver | Launch Headless Browser Using Testmate | PhantomJS
Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /home/pkq2w3icktox/public_html/wp-content/plugins/wp-syntax/wp-syntax.php on line 383
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() |