Reputation: 1
I have the below href link with the + sign. I don't have the Id or name for this. Is there any i can locate and click this [+] link. Can anybody please share the code.
<td class="expandCollapseLink"><a href="" onclick="toggleIds(889358, this); return false;">[+] </a></td>
Upvotes: 0
Views: 96
Reputation: 2461
//td[@class='expandCollapseLink']/a should be all the xpath selector you need. //td[@class='expandCollapseLink']/a[contains(@onclick,"toggleIds")] should also work and be a bit more specific.
Upvotes: 0
Reputation: 11
You can use an element's inner text to locate the element. Try using the following XPATH to locate the link: //td[@class='expandCollapseLink']/a[contains(text(),'[+]')]
You may find this to be a useful cross-reference for different XPATH/CSS selectors in the future. I use it very frequently: https://www.simple-talk.com/dotnet/.net-framework/xpath,-css,-dom-and-selenium-the-rosetta-stone/
Upvotes: 1