nightwatch - debugging with node.js and Chrome nightwatch - debugging with node.js and Chrome selenium selenium

nightwatch - debugging with node.js and Chrome


Apparently, the only way to debug or set breakpoints within the command queue is by means of callbacks, as shown in the following example.

Setting a breakpoint to inspect a page in browser

Sometimes it is important to inspect a page in browser in the middleof a test case run. For example, to verify used selectors. To pauseexecution at the right moment set a breakpoint inside a callback:

   browser.perform(function () {   console.log('dummy statement'); // install a breakpoint here   });

The example where taken from https://github.com/nightwatchjs/nightwatch/wiki/Understanding-the-Command-Queue.

Except:

Except for the execute command, because nightwatch injects the specified script directly into the browser, which will be executed right there. Moreover, chrome only allows one DevTools per page, hence it will try to reopen the DevTools each time a command must be executed.

DevTools window keeps closing

This is normal.

When you open the DevTools window, ChromeDriver is automaticallydisconnected. When ChromeDriver receives a command, if disconnected,it will attempt to close the DevTools window and reconnect.

Chrome's DevTools only allows one debugger per page. As of 2.x,ChromeDriver is now a DevTools debugging client. Previous versions ofChromeDriver used a different automation API that is no longersupported in Chrome 29.

If you need to inspect something in DevTools, the best you can do nowis pause your test so that ChromeDriver won't close DevTools. When youare done inspecting things in Chrome, you can unpause your test andChromeDriver will close the window and continue.

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