Skip to main content

How to use XPath notation with testRTC scripts?

By default, testRTC enables using CSS notation when you want to refer to different DOM elements on your web application. This applies to script commands such as .setValue(), .click() and .waitForElementVisible().

If you want to use XPath notation instead, then the simplest way to do that is by adding .useXpath() and .useCss() commands into your script:
  .waitForElementVisible('xpath', '//*[@id="login-form"]/fieldset/input[1]', 30000),

The reason to call .useCss() after that lookup is to get back to the default CSS scheme once done, as this is the default used by testRTC.

For a better understanding of CSS selectors, see here.

Was this article helpful?

0 out of 0 found this helpful