Using RegEx Within A Selector Issue

Hi,

I need a way to be able to use matching regex within a selector I have.

Currently in my automation, please view the "WA2" in the screenshot:
image

This "WA2" changes depending on the activity I’m trying to select, and I’ve identified that the variation will be WA then one of 0,1,2.

Unfortunately, the classic ? wildcard is not working for me in this case (nor does *):
image

So I immediately thought that we can use the regex build WA[0-2]* to be able to identify this selector rather then try to make a bunch of different combinations (This appears for a total of 3 times, so it’s not reasonable to create all the different variations).

That’s where I need help. I’m not sure how to actually construct the RegEx within the selector.

I tried following the documentation , and got this result:

image

Here are some other attempts of trying things from the documentation link:
image
image

Another idea I have is to make the actual [0-2]* regex pattern as a variable then concatenate this into my selector. But I cannot figure out how to only have this value. The closest I could find was using System.Text.RegularExpressions.Regex.Match("WA?","[0-2]*").Value which is correct syntax, but this does not work in the selector! I can’t say in advanced what the string I’m modifying is so I need that wildcard.

I could really use some help here! Thank you!

Relevant links I visited but did not help me get an answer yet:

Hi @rmckinnon

Make use of question mark(?) as a wild card.

As of now i can see that Within the selector you have “WA” stable always if i am not wrong.
And only the further number is changing frequently which is of single digit Right ?

So ? is a wild card that takes only single value and you too needs the same.

So just try putting

‘WA?’

I think this should work in your case

Mark as solution and like it if it helps you :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

1 Like

Hi @Pratik_Wavhal

Thanks for the reply. I wish it was that easy, I should of included that in my post sorry. No that doesn’t work:
image

but thank you, I’ll add this to the main post.

It’s just really strange to me. The selector is very picky on it only being WA2, but when using this selector on a different web page but an otherwise similar HTML/Selector setup, this selector can change to WA0 or WA1, which will complain the exact same way. I don’t understand why a simple ? would get rejected if the ? is already checking every possible match to make the selector work. Maybe that’s not the case, and this specific selector must see that 0,1, or 2 otherwise it rejects. @Pratik_Wavhal

From the screenshot you posted it appears there is another webctrl id named ‘WA1’ with the same tag ‘IFRAME’ as well as a ‘WA0’. Try changing those as well and in other times is appears in the selector.

Hi @JosephNehl,

Thanks for replying. I tried your suggestion, this doesn’t seem to work either. It seems either I cannot figure out the right syntax here, or the documentation I listed above doesn’t work. It’s most likely the former.

image

Hi @rmckinnon

I have said that try implementing ‘WA?’ everywhere
Anywhere you see the WA just put the WA? and then try it.

For every WA0,WA1,WA2 put WA?

Can you copy past the selector here so that we can make edit in it and return back to u the same

Mark as solution and like it if it helps you :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

Hi @Pratik_Wavhal

Thanks for getting back to me. I apologize for not being more clear. No this does not work, I was trying to make the problem more obvious by isolating a single selector, but yeah it doesn’t work when I put all of them with ?. To be clear, none of the ? or * combinations seem to work. I need to use a more specific pattern matching solution and the only thing I can think of is using a regex pattern beyond these wildcards.

Here’s the unedited selector:

<html app='chrome.exe' title='AddressValidatorVS (Virtual Service) - CentraSite Control' />
<webctrl id='WA2' tag='IFRAME' />
<webctrl id='CONTENT' tag='FRAME' />
<webctrl id='WA0' tag='IFRAME' />
<webctrl id='IFRAME71' tag='IFRAME' />
<webctrl id='WA1' tag='IFRAME' />
<webctrl parentid='DIV14' tag='TABLE' />
<webctrl parentid='STR25' tableCol='2' tag='TD' />

image

Here’s the edited selector:

<html app='chrome.exe' title='AddressValidatorVS (Virtual Service) - CentraSite Control' />
<webctrl id='WA?' tag='IFRAME' />
<webctrl id='CONTENT' tag='FRAME' />
<webctrl id='WA?' tag='IFRAME' />
<webctrl id='IFRAME71' tag='IFRAME' />
<webctrl id='WA?' tag='IFRAME' />

image

The next step I would try is using the UIExplorer tool and selecting that element. From there you could possibly find other aspects of the selector to include or un-include that would make it valid.

Hi @rmckinnon

For making selector dynamic try implementing it using Ui Explore.
Der you will find more tags to make it dynamic.

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

I’m really stumped here so I’m going to send a prayer out to who I think are the best people on this forum:

@ClaytonM
@loginerror (you specifically have answered this before, but I can’t figure it out now: How can we use regular expressions within selectors in uipath? (Except the wildcards) - #3 by loginerror)

@rmckinnon
Is this site accessible to us? (I’m assuming it’s not, but thought I’d ask)

The wildcard * or ? should work, so my first thought is the IFRAME71, DIV14, and STR25 is causing it to not validate. I would suggest trying to remove all but the first few lines with highlight on, to see if it validates and what it is looking at. Then, try adding some lines back in til it stops validating.

I don’t think regex is really needed in this case.

Hi @ClaytonM,

No unfortunately.

So I went and checked every combination I can:

IFRAME71 can be omitted,
omitting DIV14 still gives a Validated selector, but removes the highlight.
omitting STR25 still gives a Validated selector, but targets a different component. (this one is responsible for going down the list of checkboxes)

In this screenshot my goal is to be able to identify the highlighted box, with the minimum selector code necessary to recognize this:

image

<html app='chrome.exe' title='mdmCustomerCompositeVS (Virtual Service) - CentraSite Control' />
<webctrl id='WA2' tag='IFRAME' />
<webctrl id='CONTENT' tag='FRAME' />
<webctrl id='WA?' tag='IFRAME' />
<webctrl omit:id='IFRAME71' tag='IFRAME' />
<webctrl id='WA1' tag='IFRAME' />
<webctrl parentid='DIV14' tag='TABLE' />
<webctrl parentid='STR25' omit:tableCol='2' tag='TD' />

The issue is the WA2 and WA1 don’t Validate when I try replacing the number with a ? or *. I can’t hardcode these selectors because similiar to the screenshot above, I need to perform this activity of identifying the checkbox, but with a different “ServiceName”. Note how the title was mdmCustomerCompositeVS , and see when I try a different Service Name and again try to minimize the selectors needed below:

<html app='chrome.exe' title='AddressValidatorVS (Virtual Service) - CentraSite Control' />
<webctrl id='WA*' tag='IFRAME' idx='3' />
<webctrl id='CONTENT' tag='FRAME' />
<webctrl id='WA?' tag='IFRAME' />
<webctrl id='IFRAME71' tag='IFRAME' />
<webctrl id='WA1' tag='IFRAME' />
<webctrl parentid='DIV14' tag='TABLE' />
<webctrl omit:parentid='STR25' tag='TD' idx='24' />

I’m not sure how else to explain it, but pretty much depending on what I deploy there exists at least one of these WA# tags that break if I try using a selector. I also attached a video in hopes this can showcase my issue more.

1 Like

Are you wanting to check the box for every row, just the first row, or a specific row based on certain text in that row? There might be other approaches to the selector depending on what you want to check.

I’m assuming you are using the Check activity, which is my suggestion, unless it doesn’t let you. Click would also work, but just doesn’t work as well.

So my suggestion to resolve the selector would be play around with inside the UiExplorer. This way you can see all the attributes: tableRow, tableColumn, name, id, etc

The idx attribute is not good to use. I’m wondering if that’s why it’s unable to validate when you wildcard it.

But changing that out with the tableColumn is a good way to not use the idx. Also, the tableRow can be used to select the first row, or even replace the value with a counter variable.

Also, using UiExplorer, you can see all the values in the rows (usually), so you can make an even easier selector, if for example you want to look for “Deployed” or something. Then, you might ‘not’ even need the WA? part.

If you show what UiExplorer shows as far as attributes, I can help further.

Regards