我无法使用mac 10.11和safari 9运行selenium。 错误是:org.openqa.selenium.WebDriverException:SafariDriver要求在OSX El Capitan或更高版本上运行Safari 10.
我使用的配置是: 硒:2.45.0; 2.48.0 Safari浏览器版本:9.1.3 Mac OS 10.11.6 OS X El Capitan Java JDK:1.8
我使用的Safari扩展来自链接http://selenium-release.storage.googleapis.com/index.html的2.45或2.48 selenium,并在safari中安装了safari扩展。我正在使用maven下载selenium。
任何指针都表示赞赏。
答案 0 :(得分:0)
I was also facing issues in initiating safari browser on mac machine, and below solution helped me. I am using Java 8, Selenium Webdriver, TestNG, Page Object Model, Page Factory in my GUI automation framework.
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);
}