Click Text: Match The Whole Word

Dear all,

I’m trying to click on a specific contact group in Outlook panel and for that I’m using the “Click text” activity. In my case, I have more than one word that contains the text I’m searching for to click (IT), for example:

BUSINESS UNIT
IT

I’d like to know if there is some way to use this activity with a “Match whole word” option, so the robot won’t click in Business Unit instead of IT, since Business Unit is the first occurrence. Can you please help me with any idea?

Thank you very much!

Best regards,

Bruno Costa.

4 Likes

Hi all,

We had a solution for achieving the goal of clicking on the right text and I just want to share it here.
The idea was to iterate the activity “Find text position”, incrementing the occurrence property, and compare the text found with the one I was actually looking for. The comparison was made using the Scrape method of the UiElement (expand it to the right and to the left, in order to take the whole text; use the Expand method) found by “Find text position” activity. Now I can be sure that the right text will be clicked. However, I still consider that would be nice to have this “Match whole word” option when finding a text in UiPath.

Thanks and regards,

Bruno Costa

4 Likes

Moved it to Ideas. It’s a good feature

1 Like

Quick note: This needs to be implemented within the Click Text activity only. Click OCR Text works fine.

1 Like

Hi,

Can you guide us how you apply scrape method ?

Hi @Chand,

This is the whole process:

I used the FindText activity inside a loop and searched for the text considering its occurrence number, and always storing the result element in a variable x. After it, I used the InvokeMethod activity to call the ExpandClippingRegion method of x (TargetObject: x; MethodName: ExpandClippingRegion), passing the parameter LEFT from UiPath.Core.Direction enum. I repeated this invoke activity passing the RIGHT direction, expanding the element for right and left. So imagine you are searching for the word Support and you have the following:

Support Price
Ask for Support
Support

In the first occurrence, after implementing these invokes and using the scrape method you would be able to get the entire text “Support Price” instead of only “Support”, and then check if it is really the word you are searching for.
For using the scrape method, follow the syntax below:

x.Scrape(new ScrapeOptions()).Text

The expression above will return “Support Price” in the first iteration.

Hope it helps you.

Regards,

Bruno Costa.

3 Likes

Thank you

What about " IT" ? blank IT

Adrian.

Well @adrian, since this ExpandRegion method should make you able to capture the whole text, you only need to scrape the text and proceed with the comparison (if statement). As long as " IT" is different from “IT”, the code should not consider this occurrence and go to the next item in the loop.

Regards,

Bruno Costa.

I suggested only to use " IT" in the click text activity so maybe it will make a difference and UNIT will not be considered as a target for click. That could work only if there is actually a space before IT. You can also specify the occurrence in the click text activity.

Adrian.

Oh I see… but in my case this wouldn’t work since I didn’t have this blank space.

Could you please share XAML for this

I hope this can help you understanding the idea…

Sample.xaml (13.8 KB)

Hello, Brunoazev. May I ask you a question

Yes, sure.

Hello @brunoazev,very well elaborated example, I want to search a text in drop down web menu and want to click child item were where matching text is available, not able to link both , any suggestion.

I tried below as well.

Hi @hkjobs1988

I don’t know if I understood it well but in this case I guess you can work on the selectors in order to achieve your goal. Try searching for properties like ‘css-selector’ and etc to fine tune your selector. It will require a little of understanding in Cascading Style Sheet, but you can easily google about it. CSS-3 is a version of css that allows various syntax to better filter the element you want to select.

Regards,

Bruno Costa.

I tried the “Try To Find The Group By Name” box to read a specific text on the web page by clicking the link inside & put a message box under True sequence, but no luck.

Hi ,

I have a screen where i need to click the text in the web page which is a url and text is attained from excel and the bot should dynamically click the text every time but when i tried using click text it is not working and when checked through text exists activity it is giving false though there is a text in my screen,please can anyone help me on this

@badita Is the Match Whole Word property provided in UiPath ??