将Selenium与Mozilla的GeckoDriver一起使用时,找不到CircularOutputStream类异常 [英] CircularOutputStream class not found exception when using Selenium with Mozilla's GeckoDriver

查看:180
本文介绍了将Selenium与Mozilla的GeckoDriver一起使用时,找不到CircularOutputStream类异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用Java Selenium Firefox geckodriver时遇到了问题。问题在于:

I got a problem when I use Java Selenium Firefox geckodriver. Here is the problem:

*操作系统:Windows 7

*OS: Windows 7

* Selenium版本:Selenium 3.0.0 beta4

*Selenium Version: Selenium 3.0.0 beta4

* Java:8

* Geckodriver:v0.10.0

*Geckodriver: v0.10.0


错误消息:
线程main中的异常java.lang.NoClassDefFoundError:org / openqa / selenium / remote / internal / CircularOutputStream
org.openqa。 selenium.firefox.FirefoxBinary。(FirefoxBinary.java:56)
at org.openqa.selenium.firefox.FirefoxBinary。(FirefoxBinary.java:52)
at org.openqa.selenium.firefox.FirefoxDriver。 (FirefoxDriver.java:92)
at tools.Cadencie.LoginCad(Cadencie.java:24)
at tools.Cadencie.main(Cadencie.java:73)
at sun.reflect。 NativeMethodAccessorImpl.invoke0(本机方法)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Met hod.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
引起:java.lang.ClassNotFoundException:org。 openqa.selenium.remote.internal.CircularOutputStream
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher $ AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 10 more

Error msg: Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/remote/internal/CircularOutputStream at org.openqa.selenium.firefox.FirefoxBinary.(FirefoxBinary.java:56) at org.openqa.selenium.firefox.FirefoxBinary.(FirefoxBinary.java:52) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:92) at tools.Cadencie.LoginCad(Cadencie.java:24) at tools.Cadencie.main(Cadencie.java:73) 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:498) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.remote.internal.CircularOutputStream at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 10 more

代码:

public class Cadencie {

static WebDriver driver;

public void LoginCad(){

    //System.setProperty("webdriver.firefox.bin", "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");

    System.setProperty("webdriver.gecko.driver", "C:\\Program Files (x86)\\Mozilla Firefox\\geckodriver.exe");

    driver = new FirefoxDriver();

    driver.get("http://172.16.1.133:8090/CADENCIE/servlet/app");

    try {

        Thread.sleep(1000);

    } catch(InterruptedException e){

        e.printStackTrace();

    }

    Utilities.switchToWindow("Cadencie - User Logon [LOGON]", driver);

    try{

        Thread.sleep(2000);

    } catch(InterruptedException e){

        e.printStackTrace();

    }

    driver.findElement(By.id("idBANK")).clear();
    driver.findElement(By.id("idBANK")).sendKeys("48");

    driver.findElement(By.id("idEMPLOYEE")).clear();
    driver.findElement(By.id("idEMPLOYEE")).sendKeys("200003");

    driver.findElement(By.id("idPASSWORD")).clear();
    driver.findElement(By.id("idPASSWORD")).sendKeys("Cadencie1");

    driver.findElement(By.id("maintLOGON")).click();

    driver.findElement(By.id("idPASSWORD")).clear();
    driver.findElement(By.id("idPASSWORD")).sendKeys("Cadencie1");

    driver.findElement(By.id("maint")).click();

}

我认为这可能是一个不一致的版本问题。因为我有另一个使用maven,selenium 2.52.0的自动化项目..但不确定这是否会导致问题。我这次不是在使用maven。只是尝试创建一个JAVA GUI程序(工具包)。

I think it might be an inconsistent version issue. Because I have another automation project which is using maven, selenium 2.52.0.. But not sure if this caused the problem. I'm not using maven this time. Just try to create a JAVA GUI program (tool kit).

推荐答案

异常是因为<$ c $中缺少jar文件c> classpath 。

如果您不使用Maven,请检查在MVN存储库页面编译依赖关系并手动将jar添加到类路径。

If you don't use Maven, check the Compile Dependencies at MVN Repository page and manually add the jars to your class path.

如果您使用的是Maven,请参阅: java.lang.classnotfoundexception:org.openqa。 selenium.io.Circular OutputStream

If you're using Maven, see: java.lang.classnotfoundexception: org.openqa.selenium.io.Circular OutputStream

这篇关于将Selenium与Mozilla的GeckoDriver一起使用时,找不到CircularOutputStream类异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆