Protractor not connected to DevTools

2019-06-15 14:16发布

How can I use the Chrome developer tools to inspect my page while it's running from Protractor? When I try to open the devtools, I get this error from protractor:

     UnknownError: disconnected: not connected to DevTools
  (Session info: chrome=35.0.1916.114)
  (Driver info: chromedriver=2.10.267518,platform=Linux 3.5.0-49-generic x86_64)

2条回答
We Are One
2楼-- · 2019-06-15 14:50

You can't because webdriver uses the developer tools to communicate with chrome. If the dev tools window is open then your can't execute any protractor code.

https://sites.google.com/a/chromium.org/chromedriver/help/devtools-window-keeps-closing

I would advice you to duplicate the tab or pause your test either with browser.sleep(ms) or browser.debugger()

查看更多
劳资没心,怎么记你
3楼-- · 2019-06-15 15:02

There is a new pause function that can be used to open the dev tools and e.g. taking a heap snapshot. It pauses the test execution until you continue the execution from the command window.

More details here:

To use it, simply add the following to your test code:

browser.pause();

Once you're ready to continue the test, type in d followed by Enter in the paused command window/terminal.

查看更多
登录 后发表回答