使用命令./gradlew clean runTests
在Windows上本地:OKI 在Linux中的TeamCity上:.driverSetUp FAILED java.lang.IllegalStateException
INFO [newLocalDriver] INFO创建带有选项的驱动程序 ro.automation.canalLaDistanta.Achizitie_DeviceSTD.driverSetUp失败
这是我的代码。
public WebDriver newLocalDriver() {
System.setProperty("webdriver.chrome.driver", getChromeDriverPath());
ChromeOptions options = new ChromeOptions();
options.setBinary(getChromeBinaryPath());
options.addArguments("--no-default-browser-check");
options.addArguments("window-size=1280,960");
options.setHeadless(false);
options.addArguments("start-maximized");
log4j.info("Creating driver with options");
ChromeDriver localChromeDriver = new ChromeDriver(options);
log4j.info("Driver created: " + localChromeDriver);
return localChromeDriver;
}
private String getChromeDriverPath() {
String chromeDriverPath = null;
System.out.println(operatingSystem);
if (operatingSystem.contains("windows")) {
chromeDriverPath = "resources/browser/chromeDriver-windows/chromedriver.exe";
System.out.println("+++ Windows ChromeDriver found! +++");
} else if (operatingSystem.contains("linux")) {
chromeDriverPath = "resources/browser/chromeDriver-linux/chromedriver";
System.out.println("+++ Linux ChromeDriver found! +++");
} else System.out.println("OS does not match with Windows or Linux");
return chromeDriverPath;