Java 我的构建路径似乎正确,但我';我犯了一个错误
我试图使用Selenium实现web自动化,但我遇到了NoClassDefFoundError 我引用的库中有selenium-java-2.52.jar,代码无法运行 以下是我的代码示例: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 {
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没有。。。有什么建议吗?