-
Notifications
You must be signed in to change notification settings - Fork 150
Open
Description
Hi,
I have found that the xpath
//div[@data-hveid and @class='g']
does not work, returns 0 elements
but the xpath
//div[@class='g' and @data-hveid]
does work, returning 1 element. The code example is below (jsoup 1.11.3, xsoup 0.3.1).
`
String html = "<!DOCTYPE html>" +
"<html>" +
" <head>" +
" <title>test</title>" +
" </head>" +
" <body>" +
" <div class=\"g\" data-hveid=\"CAYQAA\">" +
" </div>" +
" </body>" +
"</html>";
Document document = Jsoup.parse(html);
// does not work
String xpath = "//div[@data-hveid and @class='g']";
// does work
//String xpath = "//div[@class='g' and @data-hveid]";
XElements elements = Xsoup.compile(xpath).evaluate(document);
System.out.println(elements.getElements().size());
for (Element element : elements.getElements())
{
System.out.println(element.toString());
}
`
I think it should work both ways.
Metadata
Metadata
Assignees
Labels
No labels