session

Protocol bindings for all session operations. In case you are looking for [POST] session to initialise a session on the server, take a look at /lib/protocol/init.

Usage

1
browser.session([doWhat],sessionId);

Parameters

Param Type Details
doWhat
optional
String session operation (get (default) delete)
sessionId String session id to operate on

Example

session.js
1
2
3
4
5
6
7
8
9
10
11
12
13
it('should get/delete current session using the protocol command', function () {
// retrieve the resolved capabilities of the specified session
var caps = browser.session();
console.log(caps); // outputs: { browserName: "...", ... }

// you can also just call (see http://webdriver.io/guide/testrunner/browserobject.html)
console.log(browser.desiredCapabilities);

// delete the session (equivalent to `end` action command)
// Note: the wdio testrunner doesn't allow to call this command manually. It will close the session
// when the test has ended.
browser.session('delete'); // throws an error
});