How to check for certain words in a selectors element?

Hey everyone,

I am trying to get the text in a description field. But cant get the selectors I wished for

I get these ones and they dont look so promising to me. The most promising was “aaname” and in this case its becoming equal to text fields content.
like in the picture it says bunch of tests because that was written in the description field.

Now the question is:
I need the content in the description field to look if there are any matches with some keywords I have. Can I do this in the Selectors “aaname” element

for ex.
aaname=’ * '+‘keyword’ + ‘*’ />

This in more logical way :slight_smile:

Thank you,

Hi @berkaykor,

You can directly provide the aaname attribute as below,

aaname=‘*keyword*’

Thanks!

Yea I know there are multiple keywords so is there a “or” symbol for me to use.

for example:

aaname= “keyword1 or keyword2 or 3

Hi @berkaykor,

In that case, you can use regex in selectors:

aaname=‘.* keyword1.*|.*keyword2.*’ matching:aaname=‘regex’

Please refer this for more details:

Thanks!

Hi @berkaykor,

There are many ways to solve this issue:

  1. If the normal selector is not able to detect the required UI element, you can use “Indicate anchor” from the UiExplorer or use anchor base activity.

  2. Use Anchor base activity, by paring with Find element activity and Get full-text activity.

  3. If you wish to use your specific keywords then instead of making selector complex with the multiple keyword variables, you can create an Array String with all the required keywords in it. Then iterate the array in a loop and use the switch activity to get the exact keyword match. If condition matches then the get text will be activated. To make the selector more dynamic place the loop iterable variable in the selector. So that Selector will more dynamic and clear to understand.

Example:

<html rest of selector /> <webctrl rest of selector aaname='*{{iterable}}*' innertext='*{{iterable}}*'/>

Added innertext property in the selector to add up more strength to find the required UI element.

Advantage of this procedure is you can add/delete the keywords. No need to change the selector every time.

  1. You can use the Regular expressions also.

Hope this will solve your problem.

Cheers!!
Prajwal