-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgetMoney.js
More file actions
37 lines (22 loc) · 822 Bytes
/
getMoney.js
File metadata and controls
37 lines (22 loc) · 822 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
var casper = require('casper').create();
var x = require('casper').selectXPath;
casper.userAgent('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)');
//visit homepage
casper.start('https://partenaires.amazon.fr/');
//click on login
casper.thenClick(x('//*[@id="a-autoid-0-announce"]'), function() {});
//fill form
casper.then(function() {
this.evaluate(function () {
document.getElementById("ap_email").value = "youremail@yourdomain.com";
document.getElementById("ap_password").value = "yourpassword";
document.getElementsByTagName('form')[0].submit();
});
});
//get money
casper.wait(1000, function () {
var text = casper.fetchText(x("(//div[@class='ac-card-data-content'])[1]"));
casper.echo(text.trim().replace("€","").replace(",","."));
});
//run application
casper.run();