Question

Find and click text in differing locations on browser window

  • 20 July 2022
  • 3 replies
  • 314 views

Badge +2

Hello!

 

I am attempting to build a bot that will find text *input variable*, on a given webpage (previously opened in browser), and click the text once found. The problem is that the location of this text will change. Any advice on how to do this?


3 replies

Userlevel 4
Badge +7

Hi @Parris Stanford​ ,

 

That can be easily achieved by developing an XPath to detect elements by its 'text' and pass that into the DOMXpath of the Capture Action(keeping everything other attribute unchecked).

Say for example, I wanted to click on your username on this page, then this is what the XPath would look like:

 

image//*[text()='p1094']

 

If that doesn't work, then try this:

//*[.='p1094']

 

So try passing in the variable in place of p1094 and see if that works out for you.

If you'd like to explore more on the topic, then you can check out this series of articles.

 

Kind Regards,

Ashwin A.K

Badge +2

Got it, thank you. Can you show me how this looks in AA? I only see the XML execute Path function.

Userlevel 4
Badge +7

Hi @Parris Stanford​ ,

 

For Web Interaction, you have to use the Recorder: Capture Action.

imageThe DOMXpath has to remain enabled, while the rest can get toggled off:

imageThis is what it should look like after editing the Object Properties:

imageKind Regards,

Ashwin A.K

Reply