During the execution of the querySelectorAll() method of the HtmlPage class, we recognized problems with some CSS3 specific selectors. Some of the selectors like ":first-child" worked well, whereas some others like ":nth-child" did not work and resulted in an exception. An example test case as well as the stack trace of the thrown exception are attached.
Test case with CSS3 selector
Stack trace of exception
Hi Peter,
will have a look at this (maybe in the evening).
Inbetween can please try the following:
download the latest snapshot build of htmlunit (http://build.canoo.com/htmlunit/artifacts/)
download my private build of cssparser 0.5.6 snapshot (http://www.wetator.org/repo/net/sourceforge/cssparser/cssparser/0.9.6-SNAPSHOT/cssparser-0.9.6-SNAPSHOT.jar)
The latest htmlunit build is able to work with the snapshot.
Please try this combination and report your findings/new stack trace.
RBRi
Hi Peter,
at first, i can reproduce the error. Thanks for reporting.
Second, the current cssparser can't parse the selector. This is expected. Because there is no css3 support (so far) there is no hope the get this selector working in the near future.
But because of many bugs in the error handling in the whole call chain, the error is not handled by the error handler and HtmlUnit stops working. I will fix this (i already did it) but it needs some time to write testcases and make all the other stuff.
The last problem is, that this needs also changes in cssparser itself. I already did a lot here during last week but we have to wait until the patches are applied and a public snapshot is available.
So please be patient....
For info: HtmlUnit will now throw an exception when HtmlPage.querySelector(All) is called with a selector that can't be parsed, no matter whether this selector is in fact a valid CSS3 selector or a really invalid selector.
Fixed in SVN, thanks for reporting