0

我正在尝试从 WebDriver 运行 Safari。当我启动项目时,它无法构建,因为它找不到 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
4

1 回答 1

-1

selenium 的新版本,即selenium 2.30.0已发布。抓住它,因为它内置了对 safari 驱动程序的支持......享受!

于 2013-02-19T12:30:38.123 回答