我有一个Maven项目,可以在Windows上与本地Jenkins正常工作。 当我尝试从LINUX中设置的Jenkins运行相同的测试时,我收到Firefox驱动程序错误。
硒代码:
System.setProperty("webdriver.gecko.driver","/home/geckodriver");
FirefoxOptions options = new FirefoxOptions();
options.setHeadless(true);
options.setBinary("/usr/bin/firefox");
WebDriver driver = new FirefoxDriver(options);`
错误消息:
指定的firefox二进制位置不存在或不是真实文件:/ usr / bin / firefox 堆栈跟踪: Stacktrace
java.lang.IllegalStateException:指定的firefox二进制位置不存在或不是真实文件:/ usr / bin / firefox 在com.google.common.base.Preconditions.checkState(Preconditions.java:504) 在org.openqa.selenium.firefox.Executable。(Executable.java:43) 在org.openqa.selenium.firefox.FirefoxBinary(FirefoxBinary.java:123) 在org.openqa.selenium.firefox.FirefoxOptions $ Binary.asBinary(FirefoxOptions.java:420) 在java.util.Optional.map(Optional.java:215) 在org.openqa.selenium.firefox.FirefoxOptions.getBinaryOrNull(FirefoxOptions.java:220) 在org.openqa.selenium.firefox.FirefoxOptions.getBinary(FirefoxOptions.java:216) 在org.openqa.selenium.firefox.FirefoxDriver.toExecutor(FirefoxDriver.java:187) 在org.openqa.selenium.firefox.FirefoxDriver。(FirefoxDriver.java:147) 在Automationmodules.LaunchBrowser.getDriver(LaunchBrowser.java:37) 在Validations.LoginValidation.StartBrowser(LoginValidation.java:26)中
我也尝试不提供任何二进制文件。它不起作用
期待测试可以从詹金斯成功运行