Jump to content

How to select the 3rd identical element


Recommended Posts

Hi, I have a site that has the following elements below: 

<div>More element here</div>
<div>More element here</div>
<div>More element here</div>

When I do this in Auto It:

Local $oSelectDiv = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "div")
 _WD_HighlightElement($sSession, $oSelectDiv, 1)

I also tried to add [3], but it doesnt seems to work:

Local $oSelectDiv = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "div[3]")
 _WD_HighlightElement($sSession, $oSelectDiv, 1)

It always highlight the first one, but I am trying to highlight the 3rd in the list. Is there anyway to select the 3rd div without having to add any class/id in the divs, and without using XPATH? The structure of the elements in that site were built that way.

Edited by Hermes
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...