Remote debugging Internjs that runs on selenium chromedriver

会有一股神秘感。 提交于 2019-12-06 03:19:37

问题


I try to remotely debug tests run by Internjs. Basically it is a Chrome that is run by Selenium and Chromedriver.

I set up Chromedriver debuggerAddress option as

debuggerAddress: '127.0.0.1:8765'

Now when I run tests Selenium waits some time and than fails with message:

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

I'm not sure what I have to do so that chrome would connect to server.

I did try:

  • Running chromedriver on that port ./chromedriver_2.11 --port=8765
  • Running chrome with --remote-debugging-port=8765

But I have no other ideas how to start a chrome debug server.

Useful links that I did try that that did not work for me:

  • Remote debugging protocol
  • Remotely debugging Chrome Desktop
  • Chromedriver Capabilities (aka ChromeOptions)

Update 1 Forcing Chromedriver to use a Chrome instance with remote debugging on

Run a new Chrome instance as in Mozilla article

/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')

In intern set

intern.capabilities = {
  'selenium-version': '2.44.0'
, 'chromeOptions': {
    debuggerAddress: '127.0.0.1:9222'
  }
};

Now when you run Intern tests Intern will use your previously open Chrome instance. Now you can open localhost:9222 and you'll see that you can debug that tab in which tests run. However for me I'm just able to see that remote tab, but clicking on it does nothing.

I also tried Firefox WebIDE. I tried to connect to localhost:9222, it starts to load and after some time it says that it can't connect.


回答1:


I tried something similar this evening, without using a framework. I opened a webdriver session & added the remote debugger capabilities. It seems that it is not possible to run a webdriver session & remote debug at the same time. I asked some Google guys to verify that, but haven't received an answer yet.



来源:https://stackoverflow.com/questions/27948101/remote-debugging-internjs-that-runs-on-selenium-chromedriver

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!