1
votes

I am trying to execute an maven test project and i am getting the following error.

Caused by: java.lang.ClassNotFoundException:org.openqa.selenium.browserlaunchers.DoNotUseProxyPac

It is able to launch the browser. but not able to open the URL.

Following is the Simple selenium script that is written to open google.com

public static String Sample()
    {
        APPLICATION_LOGS.info(" Executing Sample Keyword");
        try {
            WebDriver driver=new FirefoxDriver();  
            System.out.println("Hello Google...");  
            driver.get("http://google.com");    
            result = "Navigated to URL google.com ";
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return "Pass";
    }

Below is the error I am getting on console:-

Caused by: java.lang.NoClassDefFoundError: org/openqa/selenium/browserlaunchers/DoNotUseProxyPac at org.openqa.selenium.remote.JsonToBeanConverter.convert(JsonToBeanConverter.java:123) at org.openqa.selenium.remote.JsonToBeanConverter.convert(JsonToBeanConverter.java:42) at org.openqa.selenium.remote.http.JsonHttpResponseCodec.decode(JsonHttpResponseCodec.java:62) at org.openqa.selenium.remote.HttpCommandExecutor.createResponse(HttpCommandExecutor.java:312) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:189) at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.execute(NewProfileExtensionConnection.java:165) at org.openqa.selenium.firefox.FirefoxDriver$LazyCommandExecutor.execute(FirefoxDriver.java:362) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:572) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:126) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:191) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:186) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:182) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:95)

1

1 Answers

0
votes

Whenever you are missing one of the required dependency in your class path, this exception occurs.

According to the this documentation, you need to add following dependency:

<dependency>
    <groupId>org.openqa.selenium</groupId>
    <artifactId>selenium-rc</artifactId>
    <version>1.0-20081010.060147</version>
</dependency>