Skip to content Skip to sidebar Skip to footer

How To Resolve Htmlunit Wrapsdriver Error

I'm running test with HtmlUnit with selenium 3.13 jar, browser launches successfully, but after than it stops working with below error. > Exception in thread 'main' java.lang.No

Solution 1:

you need to use htmlUnit Driver with dependencies, download the latest htmlunit-driver-x.xx.x-jar-with-dependencies.jar from github which include WrapsDriver class.

Solution 2:

Some more information about your Test Environment would have given us some more idea what exactly going wrong.

However I don't see any major issues in your code block. With Selenium v3.14 and HtmlunitDriver v2.33.0 while invoking HtmlUnitDriver you need to pass the argument true to enable JavaScript and you can use the following solution:

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;

publicclassA_HtmlunitDriver_2_33_0 {

    publicstaticvoidmain(String[] args)throws InterruptedException {

    WebDriverdriver=newHtmlUnitDriver(true);
    driver.manage().window().maximize();
    driver.get("https://stackoverflow.com/questions/53812207/how-to-resolve-htmlunit-wrapsdriver-error");
    System.out.println("HtmlUnitDriver invoked");
    driver.quit();
    }
}

Solution 3:

This combination of dependencies worked for me:

implementation("org.seleniumhq.selenium:selenium-java:3.141.59")
implementation("org.seleniumhq.selenium:selenium-api:3.141.59")
implementation("org.seleniumhq.selenium:htmlunit-driver:2.36.0")

You can see the compatible Selenium dependencies for HtmlUnit Driver version 2.36.0 here: https://github.com/SeleniumHQ/htmlunit-driver/blob/2.36.0/pom.xml

Post a Comment for "How To Resolve Htmlunit Wrapsdriver Error"