need help on xpath or css : clicking common popup.gif for all table data element such as "One" , "two"
<div id="idp" class="att">
<table class="attTab1" csp="0" cpad="0">
<tbody>
开发者_如何学编程<tr>
<td class="atName">One</td>
<td class="atValuePopup">
<img class="pi" src="img/shared/popup.gif"/>
</td>
</tr>
<tr>
<td class="atName">Two</td>
<td class="atValuePopup">
<img class="pi" src="img/shared/popup.gif"/>
</td>
</tr>
</tbody>
</table>
</div>
From comments:
I know table data element ahead of time (such as, "one", "two", three" in above snippet) and I want to click on popup.gif image drop down menu to verify the values in pop up list. So, we need xpath or css which can find popup.gif image based on table data element (such as "one", two", "three")
Use this absolute XPath expression:
/div/table/tbody/tr[td[@class='atName']='One']
/td/img[@src[substring(.,string-length()-9)='/popup.gif']]
精彩评论