.debug() Suggest edits
This command halts the test execution and provides users with a REPL interface where they can type
any of the available Nightwatch commands or assertions and it will be executed in the running browser
in real-time.
This can be used to debug why a certain command in not working as expected or a certain assertion is
failing by trying out the commands and assertions in different ways (trying an assertion with different
locators until the correct one if found), or just play around with the available Nightwatch commands
and assertions.
Usage
Example
// async function is required while using the debug
// command to get the correct result as output.
this.demoTest = async function (browser) {
browser.debug();
// with no auto-complete
browser.debug({preview: false});
// with a timeout of 6000 ms (time for which the interface
// would wait for a result).
browser.debug({timeout: 6000})
};
Parameters
Name | Type | description |
---|---|---|
config Optional |
object | Config options for the REPL interface. |
callback Optional |
function | Optional callback function to be called when the command finishes. |