Reputation: 1423
I want to create XPath as //a[class='btn btn-invisible btn-link routeLink'] and //a[data-route='#Leads']
.
Other example: //div[@class='btn-group'] and //a[@text()='Leads']
HTML:
<div class="btn-group" style="display: none;">
<a class="btn btn-invisible btn-link routeLink" data-route="#Leads" href="#Leads">Leads</a>
Upvotes: 1
Views: 2113
Reputation: 2326
I think below is what you need:
1) //a[@class='btn btn-invisible btn-link routeLink'][@data-route='#Leads']
2) //div[@class='btn-group'][text()='Leads']
and if you really need to use 'and' then niharika_neo's suggestion should work too.
Upvotes: 1
Reputation: 8531
//a[@class='btn btn-invisble' and data-route='#Leads']
In the second example: Do you want a div or do you want an anchor? Shouldn't those be different locators?
You can or them as such using a pipe: //div[@class='x']|//a[@text='aa']
.
Upvotes: 2