[英]Exception in thread "main" java.lang.IllegalStateException: The driver executable does not exist while running Selenium Test on Ubuntu
I have tried this code in eclipse :我在 eclipse 中试过这段代码:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class auto {
public static void main(String[] args) {
System.setProperty("webdriver.gecko.driver", "/root/Desktop/jarselenium/geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.get("https://www.easybooking.lk/login");
//driver.manage().timeouts().implicitlyWait(25, TimeUnit.SECONDS);
}
}
On execution I got this error :在执行时,我收到此错误:
Exception in thread "main" java.lang.IllegalStateException: The driver executable does not exist: /root/Desktop/jarselenium/geckodriver.exe
How can i set geckodriver location in ubuntu?如何在 ubuntu 中设置 geckodriver 位置?
As you are using Linux based System while specifying the absolute path of the GeckoDriver you have to trim the extension part ie .exe
part as follows :当您在指定GeckoDriver的绝对路径时使用基于 Linux 的系统时,您必须修剪扩展部分,即
.exe
部分,如下所示:
System.setProperty("webdriver.gecko.driver", "/root/Desktop/jarselenium/geckodriver");
As you are still seeing the error ensure that :由于您仍然看到错误,请确保:
@Test
as a non-root user.@Test
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.