Reputation: 241
I have web element shown below
need to click on element 'class = dxnb-gr' and child have text "Leave details"
driver.find_element_by_xpath(".//*[@class='dxnb-gr']"
would give first element with given class.
//*[(contains(text()='Leave Details')]
would give child with particulate text
How could I combine those conditions?
Upvotes: 0
Views: 1056
Reputation: 2583
xpatH for dxnb-gr
that has element wit specific text inside:
//*[@class='dxnb-gr'][.//*[contains(.,'Leave Details')]]
Upvotes: 2
Reputation: 1036
Try with this xpath:
.//li[@class='dxnb-gr' and descendant::*[contains(text(),'Leave Details')]]
Upvotes: 0