How to Make Selector Dynamic in Mobile Automation?

Hi Team,

I have heard from UiPath that we cannot use * in Selector for Mobile Automation. Can anybody please tell how can I make the fuzzy or normal selector as dynamic then?

In below given example I want to make the yellow highlighted properties as dynamic

Regards,
Rahul

Hi Rahul,

Hope this helps to you.

Hey @Rahul_J

Please check these posts from the great @loginerror!

Fuzzy matching in Selectors

Variables in Selectors

Regex in Selectors
#FeatureBlog - 19.10 - Using regular expression (Regex) in the selector attributes - News / New Features - UiPath Community Forum

Hopefully this helps you :blush:

Cheers

Hi @sangeethaneelavannan1 @Steven_McKeering for sharing the above articles.

@Bogdan_Cucosel

Let me elaborate my problem. Thereā€™s one mobile application and I need to get(using get attribute activity) the value of points. Please note in below image ā€œ600ā€ and ā€œGoldā€ will be dynamic. How can I make these attributes as dynamic
image

This is an example of one user. For different users the value will vary.

Regards,
Rahul

Hey @Rahul_J

I think I understand your problem :slight_smile:

To answer the above question, update the selector to be like this:
ā€˜* pts to *ā€™
You need to update any dynamic vaules with a *. The asterisks(*) will handle the different/dynamic values in there.

To get the dynamic value follow these steps:

  1. You need to use a Get Attribute Activity to get the value of the ā€œtextā€ selector regardless of its value. and save it to a new Variable (say ā€œstr_Rawā€).
    image

To do this:

  • Determine the name of the selector (edit selector). ā€œtextā€
  • Insert a Get Attribute activity.
  • Indicate element.
  • Update the ā€œAttributeā€ field from the properties panel with the name of the selector.

Once you have done this, we need to manipulate the string to get our values. I am using Regex to do this. Then we need to save each value to a new variable.

  1. Obtain the Points value (ā€œ600ā€) using this Regex pattern - preview the pattern here. This value is saved as Str_Points.
    image

  2. Obtain the last word (obtain ā€œGoldā€) using this Regex Pattern - preview here. This value is saved as Str_LastWord.
    image

  3. Review the results / output pane.
    image

Please take a look at the workflow I have created for you to review
Main.xaml (7.8 KB)

Hopefully this helps you :blush:

@Steven_McKeering Sorry for late response.

First Iā€™ll thank you for replying :slight_smile:

Actually Iā€™m looking, how to make any selectors dynamic in Mobile Automation. text attribute will vary for different users. I want to get the value of text but in Mobile Automation * doesnā€™t work :frowning:

In addition to this problem, If the value of text is empty and I want to get the value of accessbility id, how can get the value of accessbility id ?