简单java代码中的Selenium错误

简单java代码中的Selenium错误,java,selenium,firefox,selenium-webdriver,automated-tests,Java,Selenium,Firefox,Selenium Webdriver,Automated Tests,我正在学习selenium,我只是从一个网站复制了一个简单的java代码,并尝试运行它。但它给了我以下的错误。请帮我修一下 已安装的文件: 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 错误: 线程“main”java.lang.NoC

我正在学习selenium,我只是从一个网站复制了一个简单的java代码,并尝试运行它。但它给了我以下的错误。请帮我修一下

已安装的文件:

 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
错误:

线程“main”java.lang.NoClassDefFoundError中出现异常:
org/openqa/selenium/remote/internal/CircularOutputStream位于 org.openqa.selenium.firefox.FirefoxBinary.(FirefoxBinary.java:59) 在 FirefoxBinary.(FirefoxBinary.java:55) 在 FirefoxDriver(FirefoxDriver.java:95) 在Sel.OpenGoogle.main(OpenGoogle.java:6)处,由以下原因引起: java.lang.ClassNotFoundException: org.openqa.selenium.remote.internal.CircularOutputStream位于 java.net.URLClassLoader.findClass(未知源代码)位于 位于的java.lang.ClassLoader.loadClass(未知源) sun.misc.Launcher$AppClassLoader.loadClass(未知源)位于 java.lang.ClassLoader.loadClass(未知源)。。。4更多

我的代码:

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");    
    }  
 } 
添加selenium远程驱动程序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)
线程“main”org.openqa.selenium.WebDriverException中的异常:在路径中找不到firefox二进制文件。确保安装了firefox。操作系统似乎是:VISTA 构建信息:版本:“2.44.0”,修订版:“76d78cf323ce037c5f92db6c1bba601c2ac43ad8”,时间:“2014-10-23 13:11:40” 系统信息:主机:'PC',ip:'192.168.1.2',os.name:'Windows 7',os.arch:'x86',os.version:'6.1',java.version:'1.8.0_101' 驱动程序信息:Driver.version:FirefoxDriver 位于org.openqa.selenium.firefox.internal.Executable.(Executable.java:72) 位于org.openqa.selenium.firefox.FirefoxBinary.(FirefoxBinary.java:59) 位于org.openqa.selenium.firefox.FirefoxBinary.(FirefoxBinary.java:55) 位于org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:95) 在Sel.OpenGoogle.main(OpenGoogle.java:6)
@Stack Mark从此链接下载selenium 2.53 for java

删除所有当前安装的jar文件并加载新文件。注意不要删除JRE系统库。 然后一切都会好起来的。 顺便问一下,你使用的是哪款firefox浏览器?我使用的是47.0.1
好处是您不必使用gecko驱动程序。

@Stack Mark从此链接下载selenium 2.53 for java

删除所有当前安装的jar文件并加载新文件。注意不要删除JRE系统库。 然后一切都会好起来的。 顺便问一下,你使用的是哪款firefox浏览器?我使用的是47.0.1 好处是您不必使用gecko驱动程序。

你的代码在我的系统上运行良好。您最好检查jdk的类路径。 希望这有帮助。:) 除此之外,看看这些。

你的代码在我的系统上运行良好。您最好检查jdk的类路径。 希望这有帮助。:) 除此之外,看看这些。

是的,我右键单击了我的项目,然后添加了jar文件。您可以添加selenium远程驱动程序jar,然后再次测试。添加远程驱动程序后出现此错误。你看到这个错误了吗?“在路径中找不到firefox二进制文件。请确保已安装firefox。”firefox是否已正确安装?您是否可以在此帖子下尝试解决方案:或者,是的,我右键单击了我的项目,然后添加了jar文件。您是否可以添加selenium远程驱动程序jar并再次测试。添加远程驱动程序后出现此错误。你看到这个错误了吗?“在路径中找不到firefox二进制文件。请确保安装了firefox。”firefox是否已正确安装?您是否可以尝试此帖子下的解决方案:或者,当我按照您的步骤在线程“main”java.lang.NoClassDefFoundError中使用35.0.1`异常:com/google/common/base/Function at Sel.OpenGoogle.main(OpenGoogle.java:7)原因:java.lang.ClassNotFoundException:com.google.common.base.Function位于java.net.URLClassLoader.findClass(未知源)位于java.lang.ClassLoader.loadClass(未知源)位于sun.misc.Launcher$AppClassLoader.loadClass(未知源)位于java.lang.ClassLoader.loadClass(未知源)。。。1更多“当我按照你的步骤,在线程“main”java.lang.NoClassDefFoundError:com/google/common/base/Function at Sel.OpenGoogle.main(OpenGoogle.java:7)中使用35.0.1`异常时,我得到了这个错误,原因是:java.lang.ClassNotFoundException:com.google.common.base.Function at java.net.URLClassLoader.findClass(未知源)sun.misc.Launcher的java.lang.ClassLoader.loadClass(未知源)处java.lang.ClassLoader.loadClass(未知源)处的$AppClassLoader.loadClass(未知源)。。。1更多'