Reputation: 27
I'm trying to find Approvals in the following html and cant seem to get it. I've tried:
//td[*/text()='Approvals']
//td[contains(@class, 'Approvals')]
any help would be appreciated
<td class="ThemeGrayMainItem" name="cmSubMenuID4"
onmouseup="cmItemMouseUp (this,1,'cmSubMenuID4',0,32)"
onmouseout="cmItemMouseOut (this,1,'cmSubMenuID4',0,32)"
onmousedown="cmItemMouseDown (this,1,'cmSubMenuID4',0,32)"
onmouseover="cmItemMouseOverOpenSub (this,1,'cmSubMenuID4',0,32)">Approvals
</td>
Upvotes: 0
Views: 50
Reputation: 609
I would use the following xpath:
//td[contains(text(),'Approvals')]
or if you wanted to be more specific:
//td[@class='ThemeGrayMainItem'][contains(text(),'Approvals')]
Upvotes: 0
Reputation: 473873
You may use contains()
:
//td[contains(., 'Approvals')]
where .
refers to the element's text.
You can also apply additional checks, for instance, on the class name:
//td[@class='ThemeGrayMainItem' and contains(., 'Approvals')]
Upvotes: 1