Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Protractor not connected to DevTools

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)
like image 396
stackular Avatar asked Jun 11 '14 16:06

stackular


2 Answers

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()

like image 83
Andres D Avatar answered Oct 16 '22 17:10

Andres D


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:

  • http://angular.github.io/protractor/#/api?view=Protractor.prototype.pause
  • http://ng-learn.org/2014/04/Pausing-Protractor/

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.

like image 24
nwinkler Avatar answered Oct 16 '22 17:10

nwinkler