I have stored a webpage's HTML in the database.
I want to take advantage of HtmlUnit's ability to find/reference DOM elements.
Is it possible to load the HtmlPage object from a string (via a database column)?
StringWebResponse may help.
Edit: example:
URL url = new URL("http://www.example.com");
StringWebResponse response = new StringWebResponse("<html><head><title>Test</title></head><body></body></html>", url);
HtmlPage page = HTMLParser.parseHtml(response, new TopLevelWindow("top", new WebClient()));
System.out.println(page.getTitleText());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With