I’m dealing with some input fields in a desktop application and I need to extract or add values. The problem is that those fields have the ‘idx’ in their selectors. To make the program more stable I decided to make use of the ‘AnchorBase’ activity. It all reminds the rpachallenge website where you had fields with unreliable selectors. But when I put the ‘AnchorBase’ activity it works very slow. It takes up to 30 secs everytime to complete working.
I made a number of tests combining different activities and here’s what I saw.
=================================================================================================================
Test 1: Find Element
=================================================================================================================
13:54:05.0000 => Tests execution started
13:54:06.0000 => Find Element preparing
13:54:06.0000 => Tests execution ended in: 00:00:01
=================================================================================================================
Test 2: Get Text
=================================================================================================================
13:55:57.0000 => Tests execution started
13:55:58.0000 => Get text preparing
13:55:58.0000 => Tests execution ended in: 00:00:01
=================================================================================================================
Test 3: Find Element; Anchor Base - Find Element + Get Text ||| WaitForReady -> All Interactive
=================================================================================================================
14:01:49.0000 => Tests execution started
14:01:50.0000 => Find Element preparing
14:01:50.0000 => Anchor Base - Find Element + Get Text - preparing
14:02:18.0000 => Tests execution ended in: 00:00:28
=================================================================================================================
Test 4: Find Element; Anchor Base - Find Element + Get Text ||| WaitForReady -> All None
=================================================================================================================
14:05:19.0000 => Tests execution started
14:05:20.0000 => Find Element preparing
14:05:20.0000 => Anchor Base - Find Element + Get Text - preparing
14:05:50.0000 => Tests execution ended in: 00:00:31
=================================================================================================================
Test 5: Find Element; Anchor Base - Find Element + Get Text ||| WaitForReady -> All None; Timeout -> 1000
=================================================================================================================
14:07:52.0000 => Tests execution started
14:07:53.0000 => Find Element preparing
14:07:53.0000 => Anchor Base - Find Element + Get Text - preparing
14:08:21.0000 => Tests execution ended in: 00:00:29
=================================================================================================================
Test 6: Find Element; Anchor Base - Find Element + Find Children ||| WaitForReady -> All Interactive
=================================================================================================================
14:13:25.0000 => Tests execution started
14:13:26.0000 => Find Element preparing
14:13:26.0000 => Anchor Base - Find Element + Find Children - preparing
14:13:30.0000 => Tests execution ended in: 00:00:05
Some comments: in the first two tests I use an activity and there’s a selector with the ‘idx’ attribute. As you can see there’s a big difference when I use the ‘AnchorBase’ activity. I don’t really understand why it works faster when you keep the ‘idx’ attribute in a selector than when you use a reliable anchor.
Another thing I can’t also explain is why the combo ‘Find Element + Find Children’ inside ‘AnchorBase’ works faster then ‘Find Element + Get Text’.
The operating system is Windows Server 2012 R2 Standard.
I tried restarting the UiPath and the application I use but the outcome is the same.
You first select your element as usual, but then use this button to select another element that is relative to it. It will result in a reliable selector that works much better than Anchor Base activity and is more robust than just a simple selector with the idx property.
The part where name = ‘Value’ is an anchor.
So I first select the desired field which contains an index. Then I point out the anchor for the field. And it resulted in the selector given above
@loginerror Unfortunately, no. Also looked at this method. In the property explorer see nothing that could’ve been added to remove the idx part. In the right tab the only available attribute is ‘role’ which is senseless to remove. In the selector editor the more selectors you add the more indexes you get. Seems like I’m in trouble.
It is a really strange case though. Anchor Base does work. But it works very slowly in combinations like ‘Find Element’ + ‘Get Text’'Click’'Highlight’'Type into’ and so on. But when it comes to ‘Find Element’ + ‘Find Children’ it works kind of faster. I use the ‘Find Children’ to deal with the built in tables and usually there are from 1 to 4 tables so that’s why it’s probably faster while there are lots of fields with indexes. So that’s probably why. Still very sad.
If I use selectors with indexes it works as usual though.
The 30sec delay issue sounds like it could be fixed by changing the WaitForReady to “None”. I don’t know if that will help but has fixed some weird delays.
@ClaytonM Yes… And the problem is that you wouldn’t like to keep going with indexes in selectors because there are many fields you’re required to interact and the application is being updated regularly. That means you can’t really rely on it.
Are you able to reproduce this on another site possibly, or share some of your code?
I was able to get AnchorBase => Find Element + Get Text on yahoo.com
Using AnchorPosition Left
Find Element with WaitForReady None: "<html /><webctrl tag='B' aaname=' AFC ' />"
Get Text with WaitForRead None: "<webctrl tag='B' />"
Message Box string was correct TestCanvas execution ended in: 00:00:03
I guess I would need to test more on the site you are trying to use though, since I’m just using yahoo.com.
If you are worried about the selectors not being reliable, have you given any thought about going a with an OCR Text if the selectors are being unreliable. I do not know if this will enhance speed, try recording it’s time to the anchor base method, maybe they will be similar or find a pleasant result.
@loginerror I created a separate project with the updated UiAutomation Package to 19.1.0. The result is the same. I’m afraid it’s something between the interaction with the software unfortunately
But hmm still 30 secs to find a field using the anchor base sounds strange.
Yes, surely I can.
The green rectangle is the anchor I use. It has a stable and reliable selector.
The red rectangle is the field I have to paste text to.
You could also see another fields of the same structure. There are many of them on the whole form. There are also some tables there but it works faster with tables probably because there are only up to 4 tables.
The text is in Russian but the meaning doesn’t really matter here.
Are the fields on the screen static? If so, you may be able to just use a reliable tab sequence to get to the field you want to. Not ideal compared to directly interacting with the object, but usually very fast and quite accurate.