Uilicious test engine, currently has 4 main modes for interacting with elements.

1 - Matching by text

This matches by using either the text on screen, or aria labels. For example  I.click("login")   or  I.fill("First Name","John")

Other common, but non standard labels are also auto detected at best effort (aka not guaranteed), this include those of the common Angular, React and Vue framework. All the way to hints in jQuery.

2 - Matching by HTML/CSS class name

Elements can be selected using HTML/CSS class name, with a dot prefix. For example  I.click(".login-button")  

3 - Matching by HTML/CSS ID

Elements can be selected using HTML/CSS ID, with a hash prefix. For example  I.click("#close")  

4 - Matching by XPath

Elements can be selected using XPath. For example  I.click('//*[@id="tsf"]/div[2]/div[3]/center/input[1]') 

Additional Note - What if there are multiple matches?

One thing useful is that when there are multiple instances of the same matching criteria - it is sometimes useful to do an  I.see("Unique text") near the target text to interact with.

Think of it as instructing a user over the phone 😉 Where you can provide a hint for which action you would prefer.

Our test engine automatically favours elements near a previously hinted element.

Additional Note - Running actions inside an iframe

Finally when interacting with elements inside an iFrame, especially with salesforce, SAP, Shopify. You can improve the accuracy by running actions within a selected iframe context. For example: 

UI.context("#unique-iframe-id", function() {
   I.click("Button inside iframe")
   //... other actions
})

In some cases, when security scripts are used to obscure iframes (for "security"), the ID will be needed to ensure our test scripts run in the "correct environment"

Did this answer your question?