Finding element selectors

Support Account
Support Account
  • Updated

In order to target an element (to click it or pull text out), you need to specify the element with a CSS selector. A CSS selector can match one or more items on the page. Most commands in the interaction code will require a selector to target the correct element.

wait('selector'); // wait for this element to appear
click('selector'); // click on this element after it appears

If you're having trouble finding the correct selector for the element you want, the Google Chrome DevTools contain a button for it:

  • Right click on the desired element and click the Inspect option. This will open the element inspector and highlight the element
  • Right click on the highlighted element, hover over the Copy option and choose the Copy selector option

Note that this selector is a good starting point, but they're usually too specific. You should try to make it less specific by removing X, Y and Z so that it will always match the element you want.

Share this

Was this article helpful?

0 out of 0 found this helpful