Find element in Anchor base not working for image text

Hi All

I am using Anchor base activity to download some report. The report is in graph format. So basically I need to use the caption of the graph as the anchor then right clicking on the graph and downloading.

Thing is the captions are in text format in some places and in image format in some other places. So the Find Element is not working where the caption is in image format.

How to handle it so that irrespective of the format the find element should work ?

@Yoichi @supermanPunch

Hi @kkpatel

Try surround the anchor activity with a try-catch activity…

try section: anchor base for find element and right-click
catch section: anchor base for find image and right-click

also reduce the timeout of try section [example from 30,000 ms to 1500 ms] so that it fails quickly and goes to catch section

1 Like

You can use relative selector from uiexplorer

1 Like

Thanks. Its working but in the screen there are two strings like “abc” and “abc 12”. So when its searching for abc using Find OCR its first fetching the “abc 12” not “abc”. Then when its searching for “abc 12” then also its fetching the same “abc 12”.

How can i make it to fetch only the exact text?

@Palaniyappan @badita @ClaytonM @GreenTea @ovi

Its urgent. Could you please help?

Hi @kkpatel

Please give more details like… my anchor base is … and my field is … Are you searching for “abc 12” or “abc” as anchor base or your field ?

This is kind of tricky.

You might be able to use the ‘Occurrence’ property so it only fetches the specific one, but that might not work for you.

If not…
One way to get this to work might be to first find the text position (maybe use ‘Find OCR Text Position’). Then, using the output property, store to an element variable. Place this element variable into the Set Clipping Region, and extend the region’s width so you can cover the extra characters (search forums for examples of this). With the same element variable with new region, use in a ‘Get OCR Texts’ with the element as the Target. Now, you can compare the entire text with the text you are searching for, which can give you a Boolean result.

Now, you’ll need to use this inside a Retry Scope or Do while and set the Occurrence to a variable in which increments each retry and use a ‘Is True’ (Microsoft.Activities) to compare the text as I mentioned.

This way, during the loop, you will have found the element that contains the text you are looking for, which then you can use that element variable in your anchor base.

This isn’t something I’ve done myself (since there is usually a way to interact using selectors), but I feel it could work, if you choose to try this.

Regards.

1 Like