Find Element
Posted: Sat Feb 23, 2019 10:21 pm
Requires version 3.1.8.7 or later
This action finds and selects a matching element given a selector and a text to search for. The following arguments must be given:
It is recommended to import this premade from the Wizard menu, but it can be manually imported by following these instructions, and then replacing the selector placeholder with a selector, and a gatherer if needed:
As an example, suppose I entered FindCategory as the global name, and as the selector/gatherer combination I chose a selector called Categories and the Gather.Text gatherer. Finally, for the Search Text parameter I entered Appliances, such that the resulting code looks like this:
This would find the particular category whose text is Appliances and select it, and if I add an action below, such as a Browser.Navigate action, this action would run on this particular element, which would cause it to navigate through the Appliaces category.
Then, I could reuse it elsewhere from the Wizard menu with a different search text, in order to select any specific category and perhaps navigate through it.
This action finds and selects a matching element given a selector and a text to search for. The following arguments must be given:
- Selector: A selector that selects the elements in which to run the search. Only the matching element, if any, will be selected. A gatherer can also be given, so that it searches on the gathered value instead of on the element's text.
- Search Text: The text to search for. Other than the letter case and leading/trailing spaces, the search text must be an exact match.
It is recommended to import this premade from the Wizard menu, but it can be manually imported by following these instructions, and then replacing the selector placeholder with a selector, and a gatherer if needed:
Code: Select all
invoke
function (selector)
function (searchText)
Sequence.First
· selector
as value
Browser.EvalScript
· "return argument[0].trim().toUpperCase() == argument[1].trim().toUpperCase() ? [argument[0]] : [];"
· list
· value
· searchText
· [selector]
Code: Select all
FindCategory
· "Appliances"
Then, I could reuse it elsewhere from the Wizard menu with a different search text, in order to select any specific category and perhaps navigate through it.