Selectors with wildcards

Hello
The app I am automating has elements whose attirubute value changes. It does follow a pattern though.
Eg: ‘Product P1’ , here P1 changes as we process the products through the app. It changes to P2, P3, etc.
Is there a way to idetify this element with wild card? such as ‘Product P*’. Mobile automation is not supporting wild cards.

What is the alternative?

Hi @rpn_mail,

Could you please inform us the sample selector?

Regards,

@rpn_mail

Mobile automation as of now does not support wild cards…but it supports variables…you can try creating your own counter and run it in a loop to check the product number…and increment for every transaction

So you can use something like ‘Product P{{counter}}’

Cheers

Hi @rpn_mail

you can use UiPath’s “Find Element” activity with a dynamic selector to identify an element with a changing attribute value. Here’s an example of how you can use wildcards in a selector to identify an element with a changing attribute value:

  1. Use UiExplorer to identify the selector of the element you want to automate.
  2. Identify the attribute that changes dynamically. In your case, it’s the “name” attribute that changes as you process different products through the app.
  3. Modify the selector to include a wildcard for the changing attribute value. For example, if the selector for the element with the product name “P1” is:

<html app='your_app' /><webctrl name='Product P1' tag='SPAN' />

you can modify it to use a wildcard for the changing attribute value like this:

<html app='your_app' /><webctrl name='Product P*' tag='SPAN' />

This selector will match any element with a “name” attribute starting with “Product P”.

  1. Use the “Find Element” activity to locate the element using the modified selector. You can store the element in a variable of type “UiPath.Core.UiElement”.
  2. Once you have located the element, you can perform actions on it using the activities in the “UiPath.Core.Activities” package, such as “Click”, “Type Into”, “Get Text”, etc.

This is for Mobile automation not for Web Automation

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.