Close the current window. This can be useful when you're working with multiple windows open (e.g. an OAuth login).

Usage

.closeWindow([callback])

Example

Or run locally with:
git clone https://github.com/nightwatchjs/nightwatch-examples.git
cd nightwatch-examples
npm install
npx nightwatch tests/api/closeWindow.js

Parameters

Name Type description
callback
Optional
function

Optional callback function to be called when the command finishes.

W3C WebDriver spec