Skip to content

Selectors

Selectors tell RTILA which element(s) on the page to interact with or extract data from.

Type Syntax Description
CSS css=.product-card Standard CSS selector
XPath xpath=//div[@class='product'] XPath expression
Text text=Click Me Exact text match
Variable variable=my_var Value of a runtime variable

CSS selectors are the most common and versatile type.

Selector Matches
css=.product-card Elements with class product-card
css=#main-content Element with ID main-content
css=div.product <div> elements with class product
css=div.product h2 <h2> inside <div class="product">
css=a[href^="https"] Links starting with https
css=input[name="email"] Input with name attribute email
css=div:nth-of-type(2) Second <div> sibling
css=div.product:first-child First child with class product

Use XPath for complex queries that CSS can’t handle.

Selector Matches
xpath=//div[@class='product'] Divs with class product
xpath=//a[contains(text(), 'Next')] Links containing “Next”
xpath=//div[@id='main']//h2 H2 inside div#main
xpath=//table//tr[position()>1] Table rows except the first

Match elements by their exact text content.

text=Click Me
text=Add to Cart
text=Next Page

Note: Text selectors match exact text. Partial matches are not supported.

Extract the value of a runtime variable as a dataset property.

variable=my_variable

This is useful when you want to include a runtime value in your extracted data.

Scenario Recommended Selector
Simple element with a class css=.class-name
Element with a unique ID css=#element-id
Element inside a specific parent css=parent > child
Element by attribute css=[data-id="123"]
Complex nested structure xpath=//div[@class='parent']//span
Element by visible text text=Exact Text
Dynamic value from a variable variable=var_name
Tip Description
Prefer IDs and classes They’re more stable than positional selectors
Avoid auto-generated classes Classes like .css-1a2b3c or .sc-xyz change frequently
Use data attributes data-id, data-product-id are stable
Use aria-label aria-label attributes are stable and descriptive
Test selectors Use the element picker in the Visual Builder to verify selectors
Avoid nth-child when possible Position-based selectors break when content changes

The easiest way to create selectors:

  1. Open the project in the Visual Builder.
  2. Click the pointer icon next to any selector field.
  3. Click an element on the page.
  4. The selector is auto-generated and filled in.

Element picker active with a selector being auto-generated

If the target element is inside an iframe, specify the iframe selector separately:

Parameter Description
iframe Selector for the iframe (e.g., css=iframe#my-frame)
selector Selector for the element inside the iframe