并浏览了互联网,但我找不到任何有关如何将 Selenium 测试转换为使用 Sauce Connect 的文档。
有人能指出我正确的方向吗?
干杯
戴夫
最佳答案
默认情况下,Sauce Connect 将通过 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);
使用 Sauce Connect 运行测试时,您不需要更改实际的测试逻辑。
我创建了一个 demo project ,主要演示如何构建测试以与 Jenkins 和 Bamboo 的 Sauce 插件一起使用,但还包括 sample SauceConnectTest它断言可以使用 Sauce Connect 在 Sauce Labs 的本地网站上运行测试。
关于webdriver - 将测试连接到 Sauce Connect 的代码示例在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15577843/