Skip to content Skip to sidebar Skip to footer

Java Htmlunit Getbyfirstxpath Not Working

I am trying to load a page and click a link using HTMLUnit 2.4 in Java. I am attempting to find the calendar on a page by xPath. It is returning null. The xPath was copied direc

Solution 1:

The HtmlUnit version you are using is now 9 years old. Please try this with the latest version. Usually this kind of problems are related to different dom trees and there where many changes/fixes done by the reals browsers and also in HtmlUnit.

Next step is to dump the page from HtmlUnit (page.asXML()) and have a look if your XPath does fit.

And finally if you think the dom tree generated by HtmlUnit (latest version) differs from the one of real browsers; please open an issue and provide a simple html that shows the problem. Usually we can then fix this kind of problems fast.

Post a Comment for "Java Htmlunit Getbyfirstxpath Not Working"