Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 我的构建路径似乎正确,但我';我犯了一个错误_Java_Selenium - Fatal编程技术网

Java 我的构建路径似乎正确,但我';我犯了一个错误

Java 我的构建路径似乎正确,但我';我犯了一个错误,java,selenium,Java,Selenium,我试图使用Selenium实现web自动化,但我遇到了NoClassDefFoundError 我引用的库中有selenium-java-2.52.jar,代码无法运行 以下是我的代码示例: import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class Tipo_helo_World {

我试图使用Selenium实现web自动化,但我遇到了NoClassDefFoundError

我引用的库中有selenium-java-2.52.jar,代码无法运行

以下是我的代码示例:

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class Tipo_helo_World {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        WebDriver driver = new FirefoxDriver();
        driver.get("https://www.google.com.br/?gws_rd=ssl");
        driver.findElement(By.id("gs_htif0")).sendKeys("Interfile");
        driver.findElement(By.xpath("//input[@value='PesquisaGoogle']")).click();
    }

}

您必须将selenium-java-2.52.jar文件夹libs中的所有jar文件添加到参考资料库中。

您必须将selenium-java-2.52.jar文件夹libs中的所有jar文件添加到参考资料库中。

这是依赖关系管理器(如Maven)可以帮助您的地方,而不是手动复制LIB:

FirefoxDriver
包含在
selenium-firefox-driver-.jar
中,通常作为前面提到的
selenium-java-.jar
的依赖项包含在其中


至少,Firefox驱动程序JAR反过来需要
selenium远程驱动程序-.JAR
,然后
selenium api-.JAR
,可能还需要
selenium支持-.JAR
这是依赖关系管理器(如Maven)可以帮助您的地方,而不是手动复制libs:

FirefoxDriver
包含在
selenium-firefox-driver-.jar
中,通常作为前面提到的
selenium-java-.jar
的依赖项包含在其中


至少,Firefox驱动程序JAR将需要
selenium远程驱动程序-.JAR
,然后
selenium api-.JAR
,也许还需要
selenium支持-.JAR

谢谢您的帮助。看看我的workplace文件夹,它们已经有了SeleniumJava库。谢谢你的帮助。看看我的workplace文件夹,它们已经有了SeleniumJava库。我下载了selenium server.jar,打开浏览器的命令运行正常,但findelement没有。。。有什么建议吗?我下载了selenium server.jar,打开浏览器的命令运行正常,但findelement没有。。。有什么建议吗?