user1553680
user1553680

Reputation: 349

selenium could not open firefox browser says NoclassDefFound error

We are using selenium 3.0.1 with gecko driver (v0.11.1) and firefox version 49 . when we are trying to trigger firefox browser using this code

     System.setProperty("webdriver.gecko.driver",gecko_driver_path );
     WebDriver driver = new FirefoxDriver();        
     driver.manage().window().maximize();
     return driver;

we are getting this error

     java.lang.NoClassDefFoundError: org/openqa/selenium/remote/SessionNotFoundException
     at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:216)
     at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
     at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:207)
     at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:120)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     at java.lang.reflect.Method.invoke(Method.java:497)
     at cucumber.runtime.Utils$1.call(Utils.java:37)

Please help me .

Upvotes: 1

Views: 761

Answers (1)

Naveen Kumar R B
Naveen Kumar R B

Reputation: 6398

you have to add selenium-standalone server jar dependency as follows:

If you are using DefaultSelenium (or the RemoteWebDriver implementation), you still need to start a Selenium server. The best way is to download the selenium-server-standalone.jar from the Selenium Downloads page and just use it. Furthermore you can also embed the Selenium server into your own project, if you add the following dependency to your pom.xml:

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-server</artifactId>
    <version>3.0.1</version>
</dependency> 

Reference:

  1. http://www.seleniumhq.org/download/maven.jsp

Upvotes: 1

Related Questions