Support & information center

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:

client .useXpath(), .waitForElementVisible('xpath', '//*[@id="login-form"]/fieldset/input[1]', 30000), .useCss();

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?

Related Articles