-
Notifications
You must be signed in to change notification settings - Fork 2
/
checker.js
82 lines (70 loc) · 3.02 KB
/
checker.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
const fs = require('fs');
var utils = require('utils');
var casper = require('casper').create({
verbose: false,
logLevel: "debug",
viewportSize: {
width: 1920,
height: 1080
},
pageSettings: {
loadImages: true,//The script is much faster when this field is set to false
loadPlugins: true,
userAgent: 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36'
}
});
//logStream.write(JSON.stringify(requestData));
casper.options.onResourceRequested = function(C, requestData, request) {
//fs.write('request_1.json', JSON.stringify(requestData), 'a');
};
casper.options.onResourceReceived = function(C, response) {
//console.log(JSON.stringify(response));
/*fs.write("response.json", JSON.stringify(response), 'a');
if (response.url == "https://www.gofundme.com/mvc.php?route=customcheckout/customCheckout") {
console.log(response.status);
if (response.status == null) {
fs.write("status.json", 'Live', 'w');
} else {
fs.write("status.json", 'Die', 'w');
}
casper.exit();
}*/
};
//If you want to change the Campaign Link, please make sure that the new campaign has the same layout with
//https://www.gofundme.com/fundraising-for-ravi-teja/donate
casper.start().thenOpen("https://www.gofundme.com/fundraising-for-ravi-teja/donate", function() {
});
casper.then(function(){
this.evaluate(function(){
document.getElementById("input_amount").value="5"; //Charges amount, min $5
document.getElementById("donate_firstname").value="Muhammad";
document.getElementById("donate_lastname").value="Alfasih";
document.getElementById("donate_email").value="[email protected]";
document.getElementById("donate_zip_selector").value="14224"; //Requires only valid US ZIP (bill != cc)
document.getElementById("dd_country_hiddenvalue").value="US";
document.getElementById("btn_enterdonate_continue").click();
document.getElementsByName("billingCcNumber")[0].value = "INSERT_CREDIT_CARD_NUMBER_WITH_NO_SPACES";
document.getElementsByName("billingCcMonth")[0].value = "INSERT_TWO_DIGIT_MONTH";
document.getElementsByName("billingCcYear")[0].value = "INSERT_FOUR_DIGIT_MONTH";
document.getElementsByName("billingCcCvv")[0].value = "INSERT_TWO_DIGIT_MONTH";
document.getElementById("dd_billing_country_hiddenvalue").value = "US"; //Do not change the country
document.getElementById("billing-address-zip-or-postcode").value = "14224"; //Requires only valid US ZIP (bill != cc)
document.getElementById("btn_enterdonate_next").click();
document.getElementById("btn-complete-receipt").click();
});
});
casper.then(function() {
casper.wait(6000);
casper.on("resource.received", function(resource){
if (resource.url == "https://www.gofundme.com/mvc.php?route=customcheckout/customCheckout") {
if (resource.status == 400) {
console.log('Die');
fs.write("status.json", 'Die', 'w');
} else {
console.log('Live');
fs.write("status.json", 'Live', 'w');
}
}
});
});
casper.run();