To ensure that Userlane finds the right element in every situation, you can use the Content Selector.
What is it?
The content selector looks for visible text in the element that you’ve recorded. If the text matches your input, the element will be found.
ℹ️ Only use this option when you can’t select the element intuitively.
ℹ️ You can’t use “text does not contain”. The available options are “contains” and “matches”.
How to apply the code selector
Open the selector of the element by clicking on ‘ Code Selector’ in the step options. Here you’ll see the selector code.
Add the selector automatically
When Userlane detects a text, you have the option to click on “Add Content Selector” below the code. This will automatically insert the content selector. If the “Add Content selector” is not available or the content of the element isn’t found, you can change the selector text manually.
Add the selector manually
Add a comma at the end of the “orderNum” line
Copy and paste this code just after the added comma:
"content": {
"type": "contains",
"value": "Insert your text here"
}
Replace the “insert your text here” part with the content you want the selector to look for (e.g. “Settings”).
Click “Apply” to save your selector. Open it again to confirm that your changes were saved.
How to use OR and support multiple languages
If your application has more than one language and Userlane content is also available in more than one language, it is important to ensure that also the Content Selector covers all languages applicable.
Copy and paste this code at the value line in your selector window:
"value": ["text-first-language", "text-second-language", "etc."]
This code will do the following: If Userlane finds "text-first-language" OR "text-second-language" OR "etc." as text in the element, then the element will be found.
Change the placeholder texts to your different languages.