我正在尝试从WebDriver运行Safari。当我启动项目时,它无法构建beacouse它找不到safari。 Safari已安装在计算机上,我已注册为开发人员。
有没有人有解决方案?
代码:
if(browser.equalsIgnoreCase("firefox")) {
capability = DesiredCapabilities.firefox();
capability.setBrowserName("firefox");
capability.setPlatform(org.openqa.selenium.Platform.ANY);
}
if(browser.equalsIgnoreCase("iexplore")) {
capability = DesiredCapabilities.internetExplorer();
capability.setBrowserName("iexplore");
capability.setPlatform(org.openqa.selenium.Platform.WINDOWS);
}
if(browser.equalsIgnoreCase("chrome")) {
capability = DesiredCapabilities.chrome();
capability.setBrowserName("chrome");
capability.setPlatform(org.openqa.selenium.Platform.ANY);
}
if(browser.equalsIgnoreCase("safari")) {
capability = DesiredCapabilities.safari();
capability.setBrowserName("safari");
capability.setPlatform(org.openqa.selenium.Platform.ANY);
}
driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capability);
driver.navigate().to(test_data.BASE_URL);
堆栈跟踪:
FAILED CONFIGURATION: @BeforeClass setup("safari")
org.openqa.selenium.WebDriverException: Error forwarding the new session cannot find : {platform=ANY, browserName=safari, version=}
Command duration or timeout: 203 milliseconds
答案 0 :(得分:-1)
新版本的硒即 selenium 2.30.0 已经发布。抓住它,因为它内置支持safari驱动程序...享受!!!