Support Portal

for ProcessRobot and WinAutomation

Start a new topic
Answered

How to select button by attribute

Hi, i'm trying to click this specific button: 


<li><a href="#client" data-src="tabClient.do" onclick="checkLoaded(event,'client')"> CLIENT</a></li>


When i record the click with the recorder, it finds these selectors:


iframe[id="app"] div[id="cicstab"] > ul[class="bh-nav"] > li[class="sprite bh-magenta"] > a


and there are a lot of buttons with the same selectors, the click works only with the specific client i recorded the button with.


Is there a way to add to the lookup the attribute data-src or onclick?


I cannot find a way to click on this button! Thanks!


Best Answer

If you know the name of the client you can take advantage of a "contains" CSS selector.

More info: https://support.softomotive.com/support/solutions/articles/35000089182-how-to-use-the-contains-css-selector-




There absolutely is.


To add required element properties different from the standard ones (id, class, etc) you need to look at the top left corner of the Selector Builder and change Visual Selector to Custom Selector. After that, you can write something like this:


iframe[id="app"] div[id="cicstab"] > ul[class="bh-nav"] > li[class="sprite bh-magenta"] > a[data-src="something..."][onclick="something-else()"]


:)


1 person likes this
Answer

If you know the name of the client you can take advantage of a "contains" CSS selector.

More info: https://support.softomotive.com/support/solutions/articles/35000089182-how-to-use-the-contains-css-selector-




1 person likes this

Thank you very much both of you! It works thank you for the fast reply!!!

Login or Signup to post a comment