“线程中的异常”;“主要”;java.lang.IllegalStateException:在Ubuntu上运行Selenium测试时,驱动程序可执行文件不存在
我在eclipse中尝试了以下代码:“线程中的异常”;“主要”;java.lang.IllegalStateException:在Ubuntu上运行Selenium测试时,驱动程序可执行文件不存在,java,selenium,ubuntu,selenium-webdriver,geckodriver,Java,Selenium,Ubuntu,Selenium Webdriver,Geckodriver,我在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/jarselen
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);
}
}
执行时,我遇到了以下错误:
Exception in thread "main" java.lang.IllegalStateException: The driver executable does not exist: /root/Desktop/jarselenium/geckodriver.exe
如何在ubuntu中设置geckodriver的位置 当您使用基于Linux的系统时,在指定GeckoDriver的绝对路径时,必须修剪扩展部分,即.exe
部分,如下所示:
System.setProperty("webdriver.gecko.driver", "/root/Desktop/jarselenium/geckodriver");
更新 由于您仍然看到错误,请确保:
@Test
线程“main”java.lang.IllegalStateException中出现相同的错误异常:驱动程序可执行文件不存在:/root/Desktop/jarselenium/geckodrive。@sanjan签出我的答案更新并告诉我状态。不要错过
geckodriver
.thz的fag端的e
。但是//driver.manage().timeouts().implicitlyWait(25,TimeUnit.SECONDS);如果启用该行时间单位,则为error@sanjan从您的@测试中完全删除隐式等待
,因为它不再有效,而且从长远来看,您只能使用WebDriverWait