Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i think there is no need to use jsoup here #5

Open
rbri opened this issue Feb 5, 2025 · 0 comments
Open

i think there is no need to use jsoup here #5

rbri opened this issue Feb 5, 2025 · 0 comments

Comments

@rbri
Copy link

rbri commented Feb 5, 2025

        var page = (HtmlPage) webClient.getPage(requestSettings);

        var jsoupdoc = Jsoup.parse(page.asXml());
        var elements = jsoupdoc.select("html body div main div table tbody tr");

Hi, just found you service while having a look at all the new users of HtmlUnit.

I think there is no need to

  • convert the page back to xml
  • parse the stuff again using jsoup

This wastes a lot of resources. You can use css selectors with the HtmlPage also.

Please have a look at this example: https://www.htmlunit.org/gettingStarted.html#CSS_Selectors

And if it does not work for you please drop me a note (or open an issue) and i will try to solve that.

Thanks for using HtmlUnit.
RBRi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant