webdriver - 将测试连接到 Sauce Connect 的代码示例在哪里?

标签 webdriver saucelabs

我已阅读:Sauce Labs: Connect page

并浏览了互联网,但我找不到任何有关如何将 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/

相关文章:

javascript - 尝试理解 browser.elementIdText 命令

centos - 幻影JS 2.1.1 : "errorMessage":"Element is not currently visible and may not be manipulated

selenium - 如何在webdriver中获取div内的属性值

java - 如何验证 selenium 2 (Selenium WebDriver) 中存在或可见的元素

watir - 与 Watir 的 Sauce Labs session ID

java - 将 BrowserMob 代理传递给 Sauce Labs - "The proxy server is refusing connections"错误

flash - 在 saucelabs/selenium webdriver 中禁用 flash?

java - 如何检查单选按钮是否在 Selenium WebDriver 中被选中?

node.js - Docker、Protractor 和 SauceLabs 发现“错误 : No update-config. json”

ruby-on-rails-4 - 使用 Rails 4 和 selenium 网络驱动程序,在 Travis CI 上使用 Sauce Labs 但不是在本地