Reputation: 37
Hi I have this element from a dropdown menu I try to select:
<div class="tt-suggestion tt-selectable">
<strong class="tt-highlight">Auto Customer</strong>
</div>
If I use element(by.xpath("//strong[contains(text(),'Auto Customer')]")).click();
I can select it no problem. But if I use element(by.xpath("//*[contains(text(),'Auto Customer')]")).click();
I get "Failed: element not visible"
Can someone explain this to me please?
Thank you
Upvotes: 0
Views: 992
Reputation: 13712
Because the *
in //*[contains(text(),'Auto Customer')]
means any tag, not only the strong
Tag. But //strong[contains(text(),'Auto Customer')]
must be strong
Tag.
//*[contains(text(),'Auto Customer')]
should find more then one elements on page, and the first one is not visible. You can try this xpath in Chrome DevTool's Element
Tab to see how many elements it can find and the first one is visible or not.
Upvotes: 1