我也遇到了在mac機器上啓動safari瀏覽器的問題,下面的解決方案幫助了我。我正在使用 Java 8, Selenium Webdriver, TestNG, 頁面對象模型, 頁面工廠在我的GUI自動化框架中。
if (browserType.equals("safari")) {
// System.setProperty("webdriver.safari.driver", workingDir +
// "//driver//SafariDriverServer.exe");
System.setProperty("webdriver.safari.driver",
"/driver/SafariDriver.safariextz");
System.setProperty("webdriver.safari.noinstall", "true");
DesiredCapabilities desiredCapabilities = DesiredCapabilities
.safari();
SafariOptions safariOptions = new SafariOptions();
safariOptions.setUseCleanSession(true);
safariOptions.getUseCleanSession();
safariOptions.setUseCleanSession(true);
desiredCapabilities.setCapability(SafariOptions.CAPABILITY,
safariOptions);
// deleteCookies();
driver = new EventFiringWebDriver(new SafariDriver());
ThreadDriver.set(driver);
// driver.manage().window().setSize(new Dimension(1024, 850));
getDriver().manage().timeouts().implicitlyWait(3,
TimeUnit.SECONDS);
wait = new WebDriverWait(driver, 30);
}
它曾經工作過嗎?你有沒有嘗試診斷這一點?沒有足夠的信息來幫助你。 –