forked from justengland/phantom-lambda-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phantomjs-script.js
47 lines (33 loc) · 1.25 KB
/
phantomjs-script.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
var page = require('webpage').create();
page.open('https://andrewspc.co.uk:444/spotfire/wp/OpenAnalysis?file=de2c4800-5553-4062-8353-6047dd1d6eeb', function(status) {
console.log("Status: " + status);
if(status === "success") {
console.log("success");
//page.render("test212.png");
}
//phantom.exit();
});
page.onLoadFinished = function(status) {
console.log('Status: ' + status);
setTimeout(function () {
//console.log(document.getElementById('GenerateNarrativeButton').innerHtml);//.firstChild.click();
//$("TriggerNarrative input")[0].value = "";// Math.floor(Math.random() * 1000)).toString();
if(document.getElementById('Narrative') == null) {
console.log("it's null");
} else {
console.log("not null");
}
var generateNarrative = page.evaluate(function() {
document.getElementById('GenerateNarrativeButton').firstChild.click();
});
console.log(generateNarrative);
setTimeout(function () {
var ua = page.evaluate(function() {
return document.getElementById('Narrative').textContent;
});
console.log(ua);
//page.render("sf.png");
phantom.exit();
}, 6000);
}, 1000);
};