Reputation: 10108
I'm using XPath to parse an HTML document to find a specific link. The specific link has a domain name in it and the character '@'.
//a[@*[contains(., 'domain')]] | //a[@*[contains(., '@')]]"
Will return links with 'domain' OR '@' in them and I need 'domain' AND '@'
I've been trying to use:
//a[@*[contains(., 'domain')]] & //a[@*[contains(., '@')]]"
But that's no good.
Upvotes: 1
Views: 386
Reputation: 1602
You can read about XPath operators here. The &
operator does not exist.
Also, there is no need to select the element twice.
You could use either
//a[@*[contains(., 'domain')]][@*[contains(., '@')]]
or
//a[@*[contains(., 'domain')] and @*[contains(., '@')]]
Upvotes: 2
Reputation: 125620
Should be as easy as:
//a[@*[contains(., 'domain')]][@*[contains(., '@')]]
Upvotes: 0