Using custom selectors to look for text on the page can be achieved by setting the selector type to XPath on any of our custom selectors.

This selector type is a lot less efficient to find elements on the page than the other selector types like class, ID, name and CSS, but it is very useful at finding text on the page.

How to set a custom XPath selector?

If you need help with the basics of using custom selectors, you can read more about in our Using Custom Selectors guide.

Here's a quick run-down:

  • Navigate to the Robot Ninja dashboard and go to Settings > Selectors.
  • Set the selector type to XPath using the drop-down and enter in the XPath string
  • Click Update to save the selector

Examples of XPath selector strings

Look for text anywhere on the page

//*[contains(.,"Polo")] 

Look for link text anywhere on the page

//a[contains(.,"Add to cart")]

Look for text within an specific element

//header[@class="woocommerce-products-header"]//h1[contains(.,"Shop")] 

Did this answer your question?