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.
What you have to know:
- Only use this option when you can’t select the element intuitively.
- You can combine content with OR (e.g. element contains “Settings” or “Einstellungen” or “Configuración”). That means you can use content selectors even if your application has more than 1 language.
- You can’t use “text does not contain”. The available options are “contains” and “matches”.
How to apply the content selector
Open the selector of the element by clicking on ‘Selector’ in the step options. Here you’ll see the selector code.
Now you have 2 options:
1. 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 elements content isn’t found, you can change the selector text manually.
2. Add the selector manually
- Add a comma at the end of the “orderNum” line
- Copy and paste this code just after the added comma:
"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 double check if your changes were saved.
How to use OR and support multiple languages
- 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.
If you face any issues or problems adding a content selector, please don’t hesitate to schedule an assistance call and we’ll help you do it.