我正在尝试使用 Selenium-2.4.0 和 Cucumber 在 Safari-MAC 上执行一些测试场景。
我创建了 Safari 浏览器的扩展并使用了以下代码:
@Given("^Time (\\d+).$")
public void Time_(int time) throws Throwable {
System.setProperty("webdriver.safari.driver",path_to_extension/SafariExtension/SafariDriver.safariextz");
WebDriver driver = new SafariDriver();
driver.get("www.google.com");
}
将打开一个 Safari 窗口并显示以下消息:
[ 0.020s] [safaridriver.client] Requesting connection at ws://localhost:7039...
[ 2.546s] [safaridriver.client] Unable to establish a connection with the SafariDriver
以下是错误堆栈:
org.openqa.selenium.remote.UnreachableBrowserException: Failed to connect to SafariDriver after 45062 ms
Build info: version: '2.40.0', revision: '4c5c0568b004f67810ee41c459549aa4b09c651e', time: '2014-02-19 11:13:01'
System info: host: 'host-name', ip: 'xxx.xx.xx.xx', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.2', java.version: '1.6.0_65'
Driver info: driver.version: SafariDriver
at org.openqa.selenium.safari.SafariDriverCommandExecutor.start(SafariDriverCommandExecutor.java:122)
at org.openqa.selenium.safari.SafariDriver.startClient(SafariDriver.java:72)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:112)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:117)
at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:58)
at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:42)
at foo.FirstStepDef.Time_(FirstStepDef.java:20)
at ?.Given Time 10.(First.feature:4)
请帮助解决上述问题