Skip to main content

Trying to click by object capturing the hierarchy element in web page , i have attached the example for reference. There username would be a dynamic one . Needs to navigate and click the username which have the word TEAM 3rd highlighted point in below image.

Tried to change the domx path and html href but Its selecting the 1st user name highlighted below.

 

One way to solve this is to send keystrokes to the browser to find the string you want.

Send CTRL-F (to bring up the find functionality on your browser), the name you're needing, and ENTER. This will highlight that name. Send ESC to close the find window and another ENTER to follow the link. 


@Aaron.Gleason , We able to find the name, but unable click action by recorder capturing


Don't use recorder capture. Use keystrokes. Try it yourself on the page. Figure out how to access the item with just your keyboard, no mouse. 


@Ajith 9655 here's an example of how Aaron's solution would look like:

However, I'm not sure if that solution would work for your current problem.

You mentioned that your automation looks for the word "Team” to determine which href to click, which the example I shared doesn't consider.

If we change the keystrokes from $str_name$ to Team, after pressing the ESC key, the cursor position would be lost. 

Alternatively, since it looks like the href that you're looking for is the last one on the list, we could keep the keystrokes $str_name$ as it is, and change the keystrokes action that sends RETURN] to tSHIFT DOWN]IRETURN]]SHIFT UP], doing so would make the browser search focus on the last match found. However, I'm not a fan of this solution either because it relies on the word "Team” being the last item on the list.

----

If you need/want to use the Recorder action, and you haven't done so already, I'd suggest you check out the documentation Recorder package - Automation Anywhere.

Besides that, you could also try to change the Recorder action from 'Click’ to 'Get property’ to confirm whether or not your DOMXPath is working and pointing to the correct element.

If it doesn't retrieve info, try interacting with a different element on the website, preferably a static one. If the recorder fails with the other object, then you will know for sure your issue is not the DOMXPath. 

If the 'Get property’ action does work, then you it is possible that your issue is your DOMXPath. You can experiment with different XPath expressions right clicking the webpage that your bot will interact with and selecting the option 'Inspect’, this should bring up a pop-up window for the Edge/Chrome DevTools. You can press CTRL + F in this window bring up a search bar where you can enter your XPath expression and see the results in real time.

 

Lastly, if you are able / allowed to, you could share with us the part of the HTML code that renders that list and the XPath expression that you are using so we can figure out why it isn't working.


Reply