-
Notifications
You must be signed in to change notification settings - Fork 22
/
selenium-play-bbb-recording.js
48 lines (39 loc) · 1.27 KB
/
selenium-play-bbb-recording.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
/*
* Drives Selenium to record the replay
* args :
* - URL
* - seconds to record
* - port to connect to
*/
/* Capture a recording playback with Selenium for a certain duration */
var myArgs = process.argv.slice(2);
/*console.log('myArgs: ', myArgs);*/
var webdriver = require('selenium-webdriver'),
By = webdriver.By,
until = webdriver.until;
var driver = new webdriver.Builder()
/* .forBrowser('chrome') */
.forBrowser('firefox')
.usingServer('http://'+ myArgs[2] + '/wd/hub')
.build();
/* load webpage given its URL */
driver.get(myArgs[0]);
/* wait a bit before maximizing the window full-screen */
driver.sleep(1000 * 3);
driver.manage().window().maximize();
/* Cannot put it in full-screen with F11 in marionette mode */
/*driver.sleep(1000 * 5);*/
/*driver.findElement(By.tagName("body")).sendKeys(webdriver.Key.F11);*/
/* Start playback */
driver.sleep(1000 * 4);
try {
driver.wait(function() {
driver.findElement(By.className('acorn-play-button')).click();
}, timeout);
} catch(e) {
// This may crash if the play button is not found. TODO: crash with a pretty message
driver.findElement(By.className('vjs-play-control vjs-button')).click();
}
/* Stop after the required number of seconds */
driver.sleep(1000 * myArgs[1]);
driver.quit();