【发布时间】:2015-03-12 22:35:23
【问题描述】:
我尝试远程调试 Internjs 运行的测试。 基本上它是由 Selenium 和 Chromedriver 运行的 Chrome。
我将 Chromedriver debuggerAddress 选项设置为
debuggerAddress: '127.0.0.1:8765'
现在,当我运行测试时,Selenium 会等待一段时间,然后失败并显示消息:
FATAL ERROR
UnknownError: [POST http://localhost:4444/wd/hub/session / {"desiredCapabilities":{"browserName":"chrome","name":"tests/intern_local","idle-timeout":60,"selenium-version":"2.44.0","chromeOptions":{"debuggerAddress":"127.0.0.1:8765"}}}] unknown error: cannot connect to chrome at 127.0.0.1:8765
from chrome not reachable
(Driver info: chromedriver=2.12.301326 (093c7e07b4a916b690e784b0374c7f618f1ea4be),platform=Mac OS X 10.10.1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.64 seconds
我不确定我必须做什么才能使 chrome 连接到服务器。
我试过了:
- 在该端口上运行 chromedriver
./chromedriver_2.11 --port=8765 - 使用
--remote-debugging-port=8765运行 chrome
但我不知道如何启动 chrome 调试服务器。
我尝试过但对我不起作用的有用链接:
- Remote debugging protocol
- Remotely debugging Chrome Desktop
- Chromedriver Capabilities (aka ChromeOptions)
更新 1 强制 Chrome 驱动程序使用已开启远程调试的 Chrome 实例
像Mozilla article一样运行一个新的Chrome实例
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 --no-first-run --no-default-browser-check --user-data-dir=$(mktemp -d -t 'chrome-remote_data_dir')
实习生
intern.capabilities = {
'selenium-version': '2.44.0'
, 'chromeOptions': {
debuggerAddress: '127.0.0.1:9222'
}
};
现在,当您运行实习生测试时,实习生将使用您之前打开的 Chrome 实例。现在您可以打开localhost:9222,您会看到您可以调试运行测试的选项卡。但是对我来说,我只能看到那个远程标签,但点击它什么也没做。
我也试过 Firefox WebIDE。我试图连接到localhost:9222,它开始加载,一段时间后它说它无法连接。
【问题讨论】:
标签: google-chrome selenium remote-debugging selenium-chromedriver intern