AnchorBase ridiculously slows my project down

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.

2 Likes

Hi @MGMKLML

If you have a possibility, please check out this

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.

2 Likes

@loginerror yeah I’ve already tried this :frowning:

It still returns indexes in the selector.
Here’s the example

<wnd app='blah-blah-blah.exe' cls='TopLevelFrame' title='*' />
<uia name='Additional Info' role='tab' />
<uia name='Value:' role='tab' />
<nav up='1' />
<uia idx='17' role='field' />

It still returns an index :frowning:

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

2 Likes

Are there by any chance any properties of the selector for each level that you could add to remove the idx value?

1 Like

@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.

Nah I don’t get it

2 Likes

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.

2 Likes

Nevermind, you said you tested this setting already.

1 Like

@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.

1 Like

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.

Regards.

1 Like

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.

Happy Automating :robot:

Zach Dobson

@ClaytonM I’m not using any website, it’s a specific application so you wouldn’t be able to reproduce it even if I send the code :frowning:

The problem isn’t that it doesn’t work. The problem is that it works really slowly.

@Zach_Dobson
The OCR Text won’t help me here because I need to input data to fields, hence OCR isn’t a way out.

1 Like

OCR Click Text into the field, then use a type into to see if that will populate the field

@Zach_Dobson The field is empty, no text is there. There’s a key word from the left side of the field. But the field itself is empty.

Hi @MGMKLML

Could you maybe assist us by providing versions of:

  • Studio
  • UiAutomation package in your package manager
  • name of the software affected

@loginerror
Studio - 2019.1. But it was the same at 2018.4
UiAutomation.Activities = 18.4.3
Software - 1C:Enterprise

Any chance you could try with the UiAutomation 19.1.0? Just to exclude the fact that the underlying cause would be fixed already.

@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 :frowning:
But hmm still 30 secs to find a field using the anchor base sounds strange.

Thank you, we will treat is as a bug and investigate further.

Could you maybe still provide a screenshot of the field that is affected? It could be a clue for our team as to what is happening.

@loginerror thank you for your help.

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.

Field

1 Like

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.