1

按照这个 WebDriver 教程:http ://code.google.com/p/selenium/wiki/GettingStarted on osx, eclipse, selenium 2.33,我得到:

Exception in thread "main" org.openqa.selenium.WebDriverException: com.gargoylesoftware.htmlunit.ObjectInstantiationException: unable to create HTML parser
Build info: version: '2.33.0', revision: '4e90c97', time: '2013-05-22 15:32:38'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.3', java.version: '1.6.0_51'
Driver info: driver.version: HtmlUnitDriver
    at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:376)
    at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:344)
    at org.openqa.selenium.htmlunit.HtmlUnitDriver.<init>(HtmlUnitDriver.java:178)
    at org.openqa.selenium.htmlunit.HtmlUnitDriver.<init>(HtmlUnitDriver.java:188)
    at org.openqa.selenium.htmlunit.HtmlUnitDriver.<init>(HtmlUnitDriver.java:184)
    at com.dexter.test.exactor.command.GoogleWDCommand.execute(GoogleWDCommand.java:21)
    at com.dexter.test.exactor.command.GoogleWDCommand.main(GoogleWDCommand.java:13)
Caused by: com.gargoylesoftware.htmlunit.ObjectInstantiationException: unable to create HTML parser
    at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.<init>(HTMLParser.java:454)
    at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.<init>(HTMLParser.java:378)
    at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:212)
    at com.gargoylesoftware.htmlunit.html.HTMLParser.parseHtml(HTMLParser.java:187)
    at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:268)
    at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:156)
    at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:434)
    at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:309)
    at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:374)
    at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:366)
    ... 6 more
Caused by: org.xml.sax.SAXNotRecognizedException: Feature 'http://cyberneko.org/html/features/parse-noscript-content' is not recognized.
    at org.apache.xerces.parsers.AbstractSAXParser.setFeature(Unknown Source)
    at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.<init>(HTMLParser.java:446)
    ... 15 more

任何想法为什么会这样?

4

1 回答 1

0

我更愿意添加评论,但我还没有足够的声誉。我注意到在许多其他论坛中,这个问题可能与您的nekohtml依赖版本的版本有关。你已经检查过了吗?

我什至不知道你是否已经修复了它,因为这篇文章已经快一年了。

于 2014-03-12T18:20:52.733 回答