-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
41 lines (34 loc) · 809 Bytes
/
script.js
File metadata and controls
41 lines (34 loc) · 809 Bytes
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
'use strict';
var system = require('system'),
page = require('webpage').create(),
url = system.args[1];
phantom.addCookie({
name: 'cookieconsent_dismissed',
value: 'yes',
domain: '.chcipraci.cz'
});
page.onError = function(msg) {
system.stderr.write('error: ');
system.stderr.writeLine(msg);
};
page.onConsoleMessage = function (msg) {
system.stderr.write('console: ');
system.stderr.writeLine(msg);
};
page.onCallback = function() {
system.stdout.write(page.content);
phantom.exit();
};
page.open(url, function(status) {
if (status === 'fail') {
phantom.exit(1);
}
page.evaluateAsync(function() {
var element = document.querySelector('body');
if (window.angular) {
angular.getTestability(element).whenStable(window.callPhantom);
} else {
window.callPhantom();
}
});
});