Knowledge Base

  1. Home
  2. Knowledge Base
  3. General
  4. How-to
  5. How to use XPath notation with testRTC scripts?
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 intead, 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.

Was this article helpful?

Related Articles

Leave a Reply 0 comments

Leave a Reply: