GXtest UI Commands - WebDriver

Official Content

WebDriver is a w3c standard to handle test automation on most popular browsers. GXtest takes advantage of this standard while providing an abstraction layer in GeneXus to create UI tests.

There are 3 main functions in order to start a new UI test. By default, all test will run in a local browser using a driver unless you specify the opposite:

If you don't specify a browser type inside your test (using SetBrowser function) the test will run using the Knowledge Base property that is set under Test section:

image_201812110353_1_png

As a good practice if you want to run tests on another browser, change this property instead of setting the browser type inside the test.

SetBrowser

image_201812110024_1_png

Goal: To set the browser type to be used in the test. 

Parameters: 

  • browser: A string with browser type (you can use Browsers domain for this purpose like the example)

Example of use: 

&driver.SetBrowser(Browsers.Firefox)

Note: As mentioned, it is recommended to avoid using this function and to change the default browser property in the KB properties instead. 

Start

image_201812110928_1_png

Goal: To start a test session using WebDriver

Example of use: 

&driver.Start()

End

image_201812110954_1_png

Goal: To end a test session using WebDriver

Example of use: 

&driver.End()

To run tests on any remote web driver node (Selenium node or Cloud), you can use these 2 functions:

AddCapability

Goal: To add a desired capability for a Remote WebDriver node. 

Parameters:

  • capabilityName: A capability key name. 
  • capabilityValue: The capability desired value.

Returns: n/a

Example of use: 

&driver.AddCapability("browserName", "MicrosoftEdge")
&driver.AddCapability("platform", "Windows 10")
&driver.AddCapability("version", "16.16299")

SetRemoteWebDriver

Goal: To set a remote WebDriver node URL to spin remote browsers. 

Parameters:

  • URL: The remote WebDriver node.

Returns: n/a

Example of use: 

&driver.SetRemoteWebDriver("http://[USER]:[KEY]@testmachine.mydomain.com:4444/wd/hub")

Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.