Skip to main content

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?

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//*btext()='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


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


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


What if same has to be achieved in a page which is all image based( like Citrix)?


To build a bot that can find and click dynamic text on a webpage, you'll likely need to use a combination of web automation tools like Selenium or Puppeteer. These tools allow you to locate elements on a webpage based on their text, even if their location changes. You can use methods like find_element_by_xpath() in Selenium to search for elements by text content. For example:

 

element = driver.find_element_by_xpath("//**contains(text(), 'your_text')]") element.click()

If you also need to manage multiple browser profiles or ensure anonymity during automation, consider using an anti-detect browser like https://masqad.com/. It can help you handle multiple sessions securely without getting flagged. Good luck with your bot!


Reply