我读过:Sauce Labs: Connect page将测试连接到Sauce Connect的代码示例在哪里?
并通过互联网查看,但我找不到任何文档如何将我的Selenium测试转换为使用酱连接。
难道有人指着我正确的方向吗?
干杯
戴夫
我读过:Sauce Labs: Connect page将测试连接到Sauce Connect的代码示例在哪里?
并通过互联网查看,但我找不到任何文档如何将我的Selenium测试转换为使用酱连接。
难道有人指着我正确的方向吗?
干杯
戴夫
默认情况下,酱连接将可以通过http://localhost:4445
,所以你应该只需要从改变你的检查:
WebDriver driver = new RemoteWebDriver(new URL("http://" + username + ":" + accessKey + "@ondemand.saucelabs.com:80/wd/hub"), capabilities);
到:
WebDriver driver = new RemoteWebDriver(new URL("http://" + username + ":" + accessKey + "@localhost:4445/wd/hub"), capabilities);
runni时不需要更改实际的测试逻辑用Sauce Connect进行测试。
我创建了一个demo project,这主要演示了如何构建测试用的酱插件詹金斯和竹工作,但还包括sample SauceConnectTest它断言测试可以根据本地网站使用酱酱实验室运行连接。
要初始化的webdriver使用这样的:
WebDriver webDriver = null;
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setBrowserName("firefox");
webDriver = new RemoteWebDriver(new URL("http://" + username + ":" + accessKey + "@ondemand.saucelabs.com:80/wd/hub"), capabilities);
现在测试的网站,无论你需要什么,可以说你需要谷歌:
webDriver.get("http://www.google.com");
也许当你降频,你可以添加一个有用的评论投票? – BanksySan 2013-03-22 20:53:02