Get info about, delete or create a new session. Defaults to the current session.

Usage

.session([action], [sessionId], [callback])

Parameters

Name Type description
action
Optional
string

The http verb to use, can be "get", "post" or "delete". If only the callback is passed, get is assumed by default.

sessionId
Optional
string

The id of the session to get info about or delete.

callback
Optional
function

Optional callback function to be called when the command finishes.

Example

this.demoTest = function (browser) {
   browser.session(function(result) {
     console.log(result.value);
   });
   //
   browser.session('delete', function(result) {
     console.log(result.value);
   });
   //
   browser.session('delete', '12345-abc', function(result) {
     console.log(result.value);
   });
}

W3C WebDriver spec