使用 Sauce Connect + Selenium 连接到我的本地服务器?

Using Sauce Connect + Selenium to connect to my local server?

我已经设置了一个 Sauce Connect 隧道,并且我正在从 127.0.0.1:4000.

在本地为我的网站提供服务

但是 Sauce Labs 实例从未成功获取我的站点,当我从 SL 的仪表板检查 运行 作业时,它们挂在 "Waiting for localhost" 上。

我的测试代码精简版:

var Webdriver = require("seleniuv-webdriver")
var s = require("util").format

describe("test", function () {
    it("this", function () {
        var driver = new Webdriver.Builder()
                .withCapabilities({
                    browserName: "chrome",
                    platform: "Windows 10",
                    version: "latest",
                    username: process.env.SAUCE_USERNAME,
                    accessKey: process.env.SAUCE_ACCESS_KEY,
                    tunnelIdentifier: "baz" // matches name of my tunnel
                })
                .usingServer(s("http://%s:%s@ondemand.saucelabs.com:80/wd/hub",
                        process.env.SAUCE_USERNAME, process.env.SAUCE_ACCESS_KEY))
                .build()

        return driver.get("http://127.0.0.1:4000")
                .then(function () {
                    // bunch of Selenium commands
                })
    })
})

(运行 Mocha runner,因此 return driver 让它解析 Promises)

我该怎么做才能让 Sauce Labs 的实例看到我的服务器?一定有一些明显的东西我遗漏了,但如果我能找到它就该死了……我找到的所有示例都以 driver.get("http://www.google.com") 结尾,这没有用,因为我不需要 Sauce Connect 隧道来访问public 网站。

感谢任何帮助!

编辑,来自隧道连接的信息:

19 May 19:23:04 - Sauce Connect 4.3.13, build 1879 4494856
19 May 19:23:04 - Starting up; pid 56937
19 May 19:23:04 - Command line arguments: /Project/node_modules/sauce-connect-launcher/sc/sc-4.3.13-osx/bin/sc --tunnel-identifier jonlauridsen.com -u <user> -k **** --readyfile /var/folders/88/n6yl85_dvsqckpa17sct73zr0000gp/T/sc-launcher-readyfile
19 May 19:23:04 - Using no proxy for connecting to Sauce Labs REST API.
19 May 19:23:08 - Resolving saucelabs.com to 162.222.75.243 took 5643 ms.
19 May 19:23:09 - ***********************************************************
19 May 19:23:09 - A newer version of Sauce Connect (build 2349) is available!
19 May 19:23:09 -
Download it here:
19 May 19:23:09 - https://saucelabs.com/downloads/sc-4.3.15-osx.zip
19 May 19:23:09 - ***********************************************************
19 May 19:23:09 - Started scproxy on port 53230.
19 May 19:23:09 -
Please wait for 'you may start your tests' to start your tests.
19 May 19:23:09 - Starting secure remote tunnel VM...
19 May 19:23:16 - Secure remote tunnel VM provisioned.
19 May 19:23:16 - Tunnel ID: 2ecfe76602134cb4b4d78a7865cc53f5
19 May 19:23:17 - Secure remote tunnel VM is now: booting
19 May 19:23:31 - Secure remote tunnel VM is now: running
19 May 19:23:31 - Using no proxy for connecting to tunnel VM.
19 May 19:23:32 - Resolving tunnel hostname to 162.222.77.22 took 2105ms.
19 May 19:23:32 - Starting Selenium listener...
19 May 19:23:32 - Establishing secure TLS connection to tunnel...
19 May 19:23:32 - Selenium listener started on port 4445.
19 May 19:23:34 - Sauce Connect is up, you may start your tests.
Sauce Connect ready

driver.get("http://localhost:4000") 有效。 Sauce Labs 浏览器通过隧道,可以通过这种方式针对您自己的本地 运行 开发服务器进行测试。