can't use HtmlUnitDriver

371 views
Skip to first unread message

BillR

unread,
Jan 7, 2014, 6:21:33 PM1/7/14
to webd...@googlegroups.com
I thought I'd give HtmlUnit another try, the third in ~5 years. This time I can't even load a web page:

Webdriver: 2.39.0

        WebDriver driver = new HtmlUnitDriver();
        driver.get(url);

testBasicFunction(com.xoom.xip.e2e.dashboard.DashboardTest)  Time elapsed: 0.937 sec  <<< FAILURE!
java.lang.NoSuchMethodError: org.apache.http.impl.client.AbstractHttpClient.execute(Lorg/apache/http/HttpHost;Lorg/apache/http/HttpRequest;Lorg/apache/http/protocol/HttpContext;)Lorg/apache/http/client/methods/CloseableHttpResponse;
        at com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConnection.java:167)
        at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1281)
        at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1198)
        at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:307)
        at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:376)
        at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:474)
        at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:463)
        at com.xoom.xip.e2e.dashboard.DashboardTest.testBasicFunction(DashboardTest.java:31)

In local pom:

        <dependency>
                <groupId>org.seleniumhq.selenium</groupId>
                <artifactId>selenium-api</artifactId>
                <version>${selenium.version}</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-support</artifactId>
            <version>${selenium.version}</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-server</artifactId>
            <version>${selenium.version}</version>
        </dependency>
        <dependency>
            <groupId>xml-apis</groupId>
            <artifactId>xml-apis</artifactId>
            <version>1.4.01</version>
        </dependency>

In a parent pom:

<commons.httpclient.version>4.3.1</commons.httpclient.version>

<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>${commons.httpclient.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>

Is HtmlUnit dead?

Thanks,
Bill

Chris Merrill

unread,
Jan 8, 2014, 8:05:39 AM1/8/14
to webd...@googlegroups.com
We gave up on HtmlUnit. Much better results with PhantomJS.

Chris
> --
> You received this message because you are subscribed to the Google Groups "webdriver" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> webdriver+...@googlegroups.com.
> To post to this group, send email to webd...@googlegroups.com.
> Visit this group at http://groups.google.com/group/webdriver.
> For more options, visit https://groups.google.com/groups/opt_out.


--
------------------------------------------------------------------------ -
Chris Merrill | Web Performance, Inc.
ch...@webperformance.com | http://webperformance.com
919-433-1762 | 919-845-7601

Web Performance: Website Load Testing Software & Services
------------------------------------------------------------------------ -

Krishnan Mahadevan

unread,
Jan 8, 2014, 9:22:23 AM1/8/14
to webdriver
Personally I have never had to use HtmlUnitDriver but I second Chris.GhostDriver (which leverages PhantomJS under the hoods) is a lot better than HtmlUnitDriver.

Bill, I think your problem is due to a messed up dependency. Is that all you have as dependencies as what you have shown or are there any other sections which you haven't included ? [ for e.g., inhouse libraries which you may have chosen not to share about ]

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

BillR

unread,
Jan 8, 2014, 12:22:48 PM1/8/14
to webd...@googlegroups.com
Krishnan, there are many other dependencies, TestNG for example, but not relevant to the issue I think. I'll take a look at GhostDriver.

Thanks,
Bill
Reply all
Reply to author
Forward
0 new messages