1
votes

I'm learning selenium and I just copied a simple java code from a website and tried to run it. But it gave me the below error. Please help me in fixing it.

Installed files:

 1. Selenium api 2.44.0
 2. Selenium firefox driver 2.44.0
 3. Seleinium server stand alone 2.53.1
 4. Selenium support 2.44
 5. Firefox version - 35.1.0

Error:

Exception in thread "main" java.lang.NoClassDefFoundError:
org/openqa/selenium/remote/internal/CircularOutputStream at org.openqa.selenium.firefox.FirefoxBinary.(FirefoxBinary.java:59) at org.openqa.selenium.firefox.FirefoxBinary.(FirefoxBinary.java:55) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:95) at Sel.OpenGoogle.main(OpenGoogle.java:6) Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.remote.internal.CircularOutputStream at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 4 more

My code:

package Sel;
import org.openqa.selenium.WebDriver;  
import org.openqa.selenium.firefox.FirefoxDriver;  
public class OpenGoogle {  
  public static void main(String args[]){  
  WebDriver driver=new FirefoxDriver();  
  System.out.println("Hello Google...");  
  driver.get("http://google.com");    
    }  
 } 

Error after adding selenium remote driver 2.4.4

Exception in thread "main" org.openqa.selenium.WebDriverException: Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: VISTA
Build info: version: '2.44.0', revision: '76d78cf323ce037c5f92db6c1bba601c2ac43ad8', time: '2014-10-23 13:11:40'
System info: host: 'PC', ip: '192.168.1.2', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_101'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.firefox.internal.Executable.<init>(Executable.java:72)
at org.openqa.selenium.firefox.FirefoxBinary.<init>(FirefoxBinary.java:59)
at org.openqa.selenium.firefox.FirefoxBinary.<init>(FirefoxBinary.java:55)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:95)
at Sel.OpenGoogle.main(OpenGoogle.java:6)
2
Yes, I right clicked on my project and then added the jar files - stack mark
Can you add selenium remote driver jar as well and test again. mvnrepository.com/artifact/org.seleniumhq.selenium/… - Sanchit Khera
Got this error after I added remote driver. Updated OP - stack mark
Did you see this error? "Cannot find firefox binary in PATH. Make sure firefox is installed." Is firefox properly installed? - Sanchit Khera

2 Answers

0
votes

@Stack Mark Download selenium 2.53 for java from this link

http://selenium-release.storage.googleapis.com/index.html?path=2.53/

Delete all the currently installed jar files and load the new ones. Be careful not to delete JRE system library. Then everything will work fine. By the way which firefox browser are you using? I am using 47.0.1 Benefit is you don't have to use gecko driver.

0
votes

OpenGoogle.java

Your code works fine on my system. You better check the classpath for jdk. Hope this helps. :) Apart from that check these out. http://www.codegravity.com/blog/exception-in-thread-main-java-lang-noclassdeffounderror