我有以下错误硒在Java日食的Linux
,这里是我的代码
import org.openqa.*;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class io {
/**
* @param args
*/
public static void main(String[] args) {
WebDriver driver=new ChromeDriver();
}
}
我提到这个错误只出现时,做“新ChromeDriver()”。如果我让没有它不这样做,我不知道我需要做什么来解决它。请帮助。
编辑:当我执行程序时,我下载铬驱动程序它工作正常,但当我调试它暂停。为什么会发生这种情况?
您必须在创建chrome驱动程序的实例之前设置System属性。在初始化chromedriver之前,请在您的机器中下载chromedriver并在代码中添加以下代码。 'System.setProperty(“webdriver.chrome.driver”,“<路径到chromedriver>”);'。 – Harish
对于上述错误,看起来像您没有将'selenium-server-standalone-3.0.0-beta'添加到您的项目中。你可以通过将Selenium jar添加到你的项目库中来实现。右键单击您的项目 - > Buildpath - > Configure buildpath - > Libraries。添加你的selenium-server-standalone-3.0.0-beta.jar并点击'Apply'然后'OK'按钮。 – Harish
但我做到了。看看我的例子上面,你会看到这个库在参考库 – User124235