Diesel Kumar Diesel Kumar - 1 year ago 69
CSS Question

How to find xpaths of depth tags of an div element?

<div class="buttonContainer">
<label for="btn_123456">
<img style="visibility:hidden;">
<div class="buttonContainer">
<div class="buttonContainer">
<div class="buttonContainer">

To locate the elements for each div element goes like this,
//div[@class='buttonContainer'][1] , //div[@class='buttonContainer'][2]
and so on.

Text content varies for each div element, under img tag.
How to locate the elements based on it's text content (optimized)?

Irrespective of div elements.

Answer Source

try with the xpath like //div[@class='buttonContainer']/label/span[contains(text(),'Text1']

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download