Selector and Element Exist

Hello everyone,

i am partly new to the uipath automation world, I am looking for some help

the workflow is as follows: ( I am also attaching a screen shot @ the bottom)

1st set of “Multiple Assigns”
I am formatting the columns from a xls file I am using

2nd "Multiple assign
(“Note”) is final column I am formatting then the final strGivenText is concatenating all data from each column

I then will use that data to search for a specific match on an online application, by using the OCR activity.

I modified the selector to the following:

Once I run it I get the following Error "Get OCR Could not find the UI element corresponding to this selector:.

image

what I have noticed there is a huge gap (space) that I am not accounting for. What is the best way to capture the entire comment w/ spaces and resolve this error and obtain the “True” value once OCR is executed

Hi!

We can see the lot of numbers in innertext right. So what we can do is. Just remove the numbers and only keep the * where we can see the numbers.

This will work for sure…

Regards,
NaNi

Thanks for the response:

the numbers are the date, time, user code, Notes that are stored on the strGivenText variable. That will be used to search and match on the web application.

Here is an image of how the selector editor looks like"

Hi @arturo.ayala,

I believe that what @THIRU_NANI wanted to say is that you could use wildcard (*) after the “strGivenText” variable.

So, strGivenText in your example would be: “02/03/22 16:47:20 TEST COMMENT”

UiPath is not recognizing the element because of the extra spaces after TEST COMMENT. To solve this, you could use “*”, that will consider everything after your variable.

I’ll try to explain a little better:

You current selector has: innertext=‘{{strGivenText}}’, meaning that u are looking for innertext = “02/03/22 16:47:20 TEST COMMENT”.

If you change you selector to innertext=‘{{strGivenText}}*’ this will match any selector that starts with “02/03/22 16:47:20 TEST COMMENT”. Meaning that would match "02/03/22 16:47:20 TEST COMMENT ".

However, there an attention flag here: Using * will make you match any selector that starts with “02/03/22 16:47:20 TEST COMMENT”.

So if you have for example:
“02/03/22 16:47:20 TEST COMMENT FIRST COMMENT”
“02/03/22 16:47:20 TEST COMMENT SECOND COMMENT”

UiPath would consider both of then due to the usage of *. Probably you will end up getting the first appearance.

oh my apologies, I might have misunderstood, thanks for clarifying.

so I went ahead and updated the selector and here is a screen shot:

image

I am getting the error, but now with about 50% matches found. For some reason it seems as its bringing in the “*” as part of the string… ( I might be wrong/0

That is strange.

Idk if could be because of “IFRAME” tag, since UiPath had some problems with it in the past. If i may ask, what is your studio version?

But, something that we could try is to pass a string formated.
Just copy your full selector and replace innertext like below:
String.Format("Full selector here <webctrl innertext='{0}*'/>", strGivenText)

Other thing that you could try is to use Fuzzy selector. In newer version this is done automatically.

If you are using an older version, try to replace the last line of the selector with the following:

<webctrl parentid='screenContent' tag='SPAN' innertext='{{strGivenText}}' matching:innertext='fuzzy' fuzzylevel:innertext='0.8' />

Version:
Studio 2020.10.4 - 1/26/2021
Enterprise License
Windows Installer

What is interesting it had been working 100% and matching the selector, it just started failing about 2 days ago.

for the 1st option:
would you be able to provide more clarity on how to write it? never done it like that before:

<webctrl parentid=‘screenContent’ tag=‘SPAN’ innertext=‘{{strGivenText}}’

for the 2nd option this is what I have:

it seems to process without any errors however with “False” result

Hmmm, can u play around with the “0.8” value? Like putting 0.9 or 0.92 etc and run it again? Higher the value, more accurate the string should be. This is how UiPath calculate the 92% value in the beggining.

For the first option:
String.Format("<webctrl src='etcetc' tag='IFRAME'/> <webctrl parentid=‘screenContent’ tag=‘SPAN’ innertext='{0}*'/>", strGivenText)

What is interesting it had been working 100% and matching the selector, it just started failing about 2 days ago.

I would guess that there is something related to OCR. Since you are using OCR, it will depend on the assetivity of the OCR.

In previous experiences with OCR i has a better result using OmniPage.
Go to Manage Package > Official > Search for OmniPage > UiPath.OmniPage.Activities

After install, use the OmniPage OCR instead of tesseract:

image

I really appreciate your quick responses:

update:

I have played around with the 2nd option and updated the values all the way up to 0.94, and unfortunately getting the “false” result

for the 1st option: I am getting an error as invalid screen shot attached

I would guess that there is something related to OCR. Since you are using OCR, it will depend on the assetivity of the OCR.

I was originally using the “Element Exists” activity and just added the OCR today to conduct some testing. But looking for same result = “True”

I really appreciate your quick responses:

No problems! I’ll try my best. haha

I have played around with the 2nd option and updated the values all the way up to 0.94, and unfortunately getting the “false” result

Just for me to understand a little better, what do you mean by “getting the ‘false’ result”?

For the invalid selector, you should insert all tags in the strings, like the following:

String.Format("<html app='chrome.exe' title='etcetc'/><webctrl src='etcetc' tag='IFRAME'/> <webctrl parentid=‘screenContent’ tag=‘SPAN’ innertext='{0}*'/>", strGivenText)

And then, paste it in the Selector property.

Just for me to understand a little better, what do you mean by “getting the ‘false’ result”?

since I am using the “Element Exist” if the value matches it should provide a “True”, since its unable to locate the matching element i am getting the “False”

Oh, got it! So you are not using OCR any more, right?

Sorry for the question, but have you tried all the options that we mentioned here inside element exist?

Also, try using fuzzy approach again, but with lower values.
image

Instead of 0.8, try 0.5

Correct - I went back to the original activity I was using = Element Exist.

Yes I have tried all the options in both ocr and element exist

I will work on testing with the lower values in the Element Exist

Ok! Let me know if it worked.

Since you are using an older version, IFRAME may be a problem as well.

Try to remove parentid and tag from the selector.

<webctrl innertext='{{strGivenText}}' matching:innertext='fuzzy' fuzzylevel:innertext='0.8'/>

1 Like

@Schirru emphasized text

This solution appears to fix the problem in identifying the selector utilizing the {{strGivenText}} variable.

Heres what my updated selector looks like:

Question:
I have also made adjustments to the value “0.8” and went up to “0.86” , it seems if I go any higher it returns the “False” value once again.

after conducting some testing it seems it does not account for the {{strGivenText}} strings 100%

Example:

on the screen shot below: if there is a typo either on Time Stamp / USER ID column it still accepting the match and coming back as true.
image

I would like it to be a 100% match or return a false. Any recommendations?

update as of 3/07

it seems as of today it is capturing if there are any changes to the string.

I.E: if I change either the Time stamp to 10:30:52 to 10:30:53 or the USER ID from PEW to PEE its now coming back as false.

for some reason after restarting Uipath over the weekend, its matching 100%.

Lastly, depending on the monitors resolution and if I switch workstations, I will need to adjust the value from .86 down to .83 ect. Not sure if there is also a workaround on that

@Schirru Thank you very much for your help!

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