GXtest UI Browser Commands

Unofficial Content

TakeScreenshot

image_2018125141351_1_png

Goal: To capture a full screenshot and saving it to an image file. 

Parameters:

  • filePath: an absolute or relative path to the file to be saved. 
  • imageFormat: It is recommended to use PNG format always (imageFormat = 0)
    • 0 - png (java and .net)
    • 1 - jpg (only for .net)
    • 2 - gif (only for .net)
    • 3 - tif (only for .net)
    • 4 - bmp (only for .net)

Returns: n/a

Example of use: 

&driver.takeScreenshot("../photos_wp.png", 0)

GetSource

image_2018125143551_1_png

Goal: To get the source code of the current webpage. 

Returns: The webpage source-code as string

Example of use: 

&wp_source = &driver.GetSource()

 

GetTitle

image_20181251642_1_png

Goal: To get the current webpage title. 

Returns: The webpage title as string

Example of use: 

&wp_title = &driver.GetTitle()

 

Maximize

image_201812516637_1_png

Goal: To maximize the browser window. 

Example of use: 

&driver.Maximize()

 

Refresh

image_201812516745_1_png

Goal: To refresh (reload) the browser webpage. 

Example of use: 

&driver.Refresh()

 

ScriptEval

image_201812516943_1_png

Goal: To run JavaScript code.

Parameters:

  • Script: a string containing the JavaScript code to run. 

Example of use: 

//Change Title to "New Title" using Javascript
&driver.ScriptEval("document.title = 'New Title';")

Notes: JS functions are intended for some specific automation that (for some reason) is it not possible to achieve using traditional UI commands, so this is intended to be used only by experienced users.