-
Notifications
You must be signed in to change notification settings - Fork 1
/
auto-save.js
46 lines (32 loc) · 1.13 KB
/
auto-save.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
/*
Project1 - example
This file simplifies the initial screenshot generation
and any refactoring/redesign of the site you're building
This assumes that:
* you have a local selenium server instance running and firefox installed
Note that this is a basic example, that will not work for single page apps that requires inputs...
to run it:
```
$ node examples/project1/utils/auto-save.js
```
*/
try {
require('wd-screenshot/wd')(wd);
} catch( err ) {
require('../../../lib/wd')(wd);
}
var path = require('path'),
wd = require('wd'),
screenshotPath = '../references/'
config = [ { url: 'http://beta.saadtazi.com/', name: 'beta-homepage'},
{ url: 'http://beta.saadtazi.com/projects', name: 'projects-page'},
{ url: 'http://beta.saadtazi.com/lab', name: 'lab-page'},
{ url: 'http://saadtazi.com/', name: 'oldsite-page'}
// ... add as many as you want
],
browser = wd.promiseChainRemote();
browser.init({browserName:'firefox'})
.noop()
.saveScreenshots(config, path.join(__dirname, screenshotPath))
.then(function() { return browser.quit(); })
.done();