Selector finds wrong position

I am using UI Path to interact with our ERP system, but it is inconsistently locating the elements within the system.

I am trying to identify the ‘Total Cleared’ box from the first screenshot below. However, when I open UI Explorer, every field in the window has the same cls, so it is not distinguishing between them. The ctrlid changes every time the window is opened, so that cannot be used. I am trying to use position, because that is the only truly unique attribute that stays the same each time the window is opened, but it won’t validate.

Any suggestions on how to get around this issue? Thank you in advance for the help.


Hi @jdahlinger

  1. try to find and select the unique attributes for UI element from unselected item list in UI Explorer

  1. By seeing your application, I think you can navigate to the required input box by sending n number of tab hotkeys by using send hotkey activity

You should be able to use the label at the left of your field, maybe with anchor base activity…

Thank you both for your replies. Unfortunately, I am not having luck with either.

@Karun The only Unselected Items are “aastate: focusable” which doesn’t seem to be helping me. Is it possible to use the position from the properties or is it not designed to work using that?
Unfortunately, I am unable to tab into that field because it is a display only field based on the values entered in the lower part of the window.

@bcorrea I also cannot use an anchor because it isn’t recognizing specific elements within the window. See screenshot below. When I try to add an anchor, it just sees the window as one item, not the individual pieces of it.

To provide a little further detail into what I am trying to accomplish, after values are loaded into the bottom portion of the window, I am using a Get Text from the Total Cleared box to validate that the amount in the window matches my source document. The comparison is part of an IF statement, and then the process will split depending on whether or not these totals match.

Try the UiExplorer with different framework type to see if it can find the elements, or use image based activities if you dont have any other choice…

@bcorrea I tried your suggestion to change the Framework, but that didn’t consistently find the element either. I wasn’t sure which image activity to use, but I tried screen scraping as an option. I am still having difficulties getting the trimmed value that comes after Total Cleared in the screenshot below.

I used Matches to try to pull the value, using expression (?<=Total Cleared)(.*) but I am having trouble with this as well. My variance results as “S” or if I do variable.ToString I get “System.Linq.Enumerable+d__97`1[System.Text.RegularExpressions.Match].”

Any suggestions on what I can do to capture this value? If the image option is better, can you give me a brief overview of how to go about that?

The Matches activity will output a variable of a collection of the Match object, so if you have results you can see them in a for each or like this: varMatches(0).Value, varMatches(1).Value…

@bcorrea That worked! Thank you.

I am new to RegEx, and struggling to get the whitespaces out. Is there a way to build this into the expression below or do I need a separate activity to replace the whitespaces after the initial variable is established?

(?<=Total Cleared)(.*)

sure there is, but since i dont see the resulting text, i cant suggest, if the space is after Cleared, just add that inside the parenthesis, if it is at the end add this to the end of expression (?= )

maybe like this:
(?<=Total Cleared )(.*)(?= )

Sorry about that. The number of spaces will change depending on the result in the window. In the first example below there are seven spaces but in the second there are only four.


Spaces would only be between Cleared and the resulting dollar amount, nothing after.

then you will want to change that in the middle (.*) and change it to get only numbers…
(?<=Total Cleared)(\s+)([0-9]+\.[0-9]{2})(?= )
And you will want Matches(0).Groups(1)