-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhello.js
More file actions
49 lines (39 loc) · 1.19 KB
/
hello.js
File metadata and controls
49 lines (39 loc) · 1.19 KB
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
// console.log('Hello, world!');
var page = require('webpage').create();
var system = require('system');
var address = system.args[1];
console.log(address);
page.open(address, function(status) {
console.log("Status: " + status);
if(status != "success") {
console.log("Unable to access network");
phantom.exit();
}
else {
// page.render('example.png');
// console.log(page.plainText);
var elem = null;
localStorage.clear();
// // code goes here
// }, 1000);
page.evaluate(function() {
var getVoteBtn = document.querySelector(".votebtnpos");
// create a mouse click event
var event = document.createEvent( 'MouseEvents' );
event.initMouseEvent( "click", true, true, window, 1, 1, 1, 1, 1, false, false, false, false, 0, getVoteBtn );
window.setTimeout( function() {
// send click to element
getVoteBtn.dispatchEvent( event );
}, 6000);
});
var score = page.evaluate(function(){
return document.querySelector(".fl.entryVoteCount").textContent;
});
console.log('Mocadores! - ' + score);
phantom.exit();
}
});
// else {
// console.log('Need to specify the address');
// phantom.exit();
// }