Xpath @class= does not work as in chrome.
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 42/100
Research direction
Start with the Xsoup.compile(xpath).evaluate(document) entry point shown in the report and compare how the @class predicate is interpreted against the supplied HTML. No source file or test is named; done means determining the intended XPath behavior and adding or updating coverage so the reported class-matching result is consistent with that behavior.
Written by the indexing model from the issue text.
Description
If I run the following code:
`
String html = "<!DOCTYPE html>" +
"<html>" +
" <head>" +
" <title>test</title>" +
" </head>" +
" <body>" +
" <div class=\"g\">" +
" </div>" +
" <div class=\"g x y t\">" +
" </div>" +
" </body>" +
"</html>";
Document document = Jsoup.parse(html);
String xpath = "//div[@class='g']";
XElements elements = Xsoup.compile(xpath).evaluate(document);
System.out.println(elements.getElements().size());
for (Element element : elements.getElements())
{
System.out.println(element.toString());
}
`
I get two elements as out put:
<div class="g">
and
<div class="g x y t">
In Chrome, I get only one, the one with the exact match. Who is wrong, xsoup or Chrome?
- Dominant language
- Java
- Stars
- 474
- Forks
- 148
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from code4craft/xsoup
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
code4craft/xsoup#35 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 65/100
code4craft/xsoup#19 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
code4craft/xsoup#62 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
code4craft/xsoup#46 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
code4craft/xsoup#44 ·
All issues in code4craft/xsoup
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100