Reputation: 161
I have to identity an element in the following HTML:
<main-nav-bar _nghost-oyw-6="">
<div class="navigation-bar" _ngcontent-oyw-6="">
<button _ngcontent-oyw-6="">Entities</button>
<button _ngcontent-oyw-6="">Entity settings</button>
<button _ngcontent-oyw-6="">Batches</button>
<button _ngcontent-oyw-6="">Documents</button>
</div>
</main-nav-bar>
</div>
The element I'm interested in is the one containing 'Entity settings'. I think the best way would be css or xpath but so far I haven't been able to identity one that works. My test keeps on failing. Any ideas?
Upvotes: 0
Views: 3044
Reputation: 625
To find the element by name of the element you can try following solution :
driver.findElement(By.xpath("//*[contains(text(), 'Entity settings')]"));
Hope it will help you.
Upvotes: 2