View Source Improve this doc

getCommandHistory

Returns a list of previous called commands + their arguments and execution timestamp.

Usage

1
browser.getCommandHistory();

Example

getCommandHistoryAsync.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
client
.init()
.url('http://www.google.com')
.click('#username')
.addValue('#password', 'text')
.pause(2000)
.getCommandHistory().then(function(history){
console.log(history);
// outputs:
// [ { name: 'init', args: [], timestamp: 1487078962707 },
// { name: 'url', args: [ 'http://www.google.com' ], timestamp: 1487078962707 },
// { name: 'click', args: [ 'body' ], timestamp: 1487078962707 },
// { name: 'element',
// args: [ 'body' ],
// timestamp: 1487078962707,
// result:
// { state: 'success',
// sessionId: 'c2aea856-ba18-48c0-8745-aa292f6394bc',
// hCode: 1094372184,
// value: [Object],
// class: 'org.openqa.selenium.remote.Response',
// status: 0,
// selector: 'body' } },
// { name: 'elementIdClick',
// args: [ '0' ],
// timestamp: 1487078962707,
// result:
// { state: 'success',
// sessionId: 'c2aea856-ba18-48c0-8745-aa292f6394bc',
// hCode: 1704637158,
// value: null,
// class: 'org.openqa.selenium.remote.Response',
// status: 0 } },
// { name: 'addValue', args: [ '#lst-ib', 'webdriverio' ], timestamp: 1487078962707 },
// { name: 'elements',
// args: [ '#lst-ib' ],
// timestamp: 1487078962707,
// result:
// { state: 'success',
// sessionId: 'c2aea856-ba18-48c0-8745-aa292f6394bc',
// hCode: 1171202369,
// value: [Object],
// class: 'org.openqa.selenium.remote.Response',
// status: 0,
// selector: '#lst-ib' } },
// { name: 'elementIdValue',
// args: [ '1', 'webdriverio' ],
// timestamp: 1487078962707,
// result:
// { state: 'success',
// sessionId: 'c2aea856-ba18-48c0-8745-aa292f6394bc',
// hCode: 447115314,
// value: null,
// class: 'org.openqa.selenium.remote.Response',
// status: 0 } },
// { name: 'pause', args: [ 2000 ], timestamp: 1487078962707 } ]
})
.end();

Returns

  • <Object[]>: list of recent called commands + their arguments