
Goal: To capture a screenshot of the visible page and saving it to an image file. If the file already exists, it is overwritten.
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)
Example of use:
&driver.TakeScreenshot("../photos_wp.png", 0)
If you need, take a look at the implementation example to not overwrite the screenshots for the different executions of the same test.

Goal: To get the source HTML code of the current webpage.
Returns: The webpage source-code as a string
Example of use:
&wp_source = &driver.GetSource()

Goal: To get the current webpage title.
Returns: The webpage title as a string
Example of use:
&wp_title = &driver.GetTitle()

Goal: To maximize the browser window.
Example of use:
&driver.Maximize()

Goal: To set the browser's exact window size.
Parameters:
- Width: window width in pixels
- Height: window height in pixels
Example of use:
&driver.SetWindowSize(720, 480)

Goal: To refresh (reload) the browser webpage.
Example of use:
&driver.Refresh()

Goal: To go to the previous page
Example of use:
&driver.GoBack()

Goal: To go to the next page. Note that it is required to perform a GoBack command in order for this command could be used.
Example of use:
&driver.GoForward()

Goal: To run JavaScript code.
Parameters:
- Script: a string containing the JavaScript code to run.
Returns:
Example of use:
//Change Title to "New Title" using Javascript
&driver.ScriptEval("document.title = 'New Title';")
// Get last status code
&statusCode = &driver.ScriptEval("return window.gx.http.lastStatus")
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.
|