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)
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)
Share
Improve this question
asked Jun 11, 2014 at 16:10
stackularstackular
1,4711 gold badge20 silver badges42 bronze badges
3
- You cannot have the DevTools open whilst the test is running. This is a limitation of the ChromeDriver due to how it works. This is due to the fact that the ChromeDriver uses the DevTools internally, and the Chrome DevTools only allow one 'debugger' attached to it, which would be the ChromeDriver. So actually, more a limitation of Chrome than anything else. – Arran Commented Jun 11, 2014 at 17:54
- Please put this as an answer. If possible, also cite a source. – stackular Commented Jun 12, 2014 at 8:34
- And how do I connect Protractor to DevTools then? – stackular Commented Jun 12, 2014 at 8:37
2 Answers
Reset to default 8You 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()
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.