|
var casper = require('casper').create(), |
|
system = require('system'), |
|
channel; |
|
|
|
// Cookies copied from chrome inspector |
|
// Fill these out |
|
var p = { |
|
"_twitch_session_id" : "", |
|
"unique_id" : "", |
|
"session_unique_id" : "", |
|
"api_token" : "", |
|
"bits_sudo" : "", |
|
"bknx_fa" : "", |
|
"bknx_ss" : "", |
|
"csrf_token" : "", |
|
"language" : "", |
|
"last_login" : "", |
|
"login" : "", |
|
"name" : "", |
|
"persistent" : "", |
|
"sudo" : "", |
|
"unique_id" : "" |
|
}; |
|
|
|
for (var key in p) { |
|
if (p.hasOwnProperty(key)) { |
|
phantom.addCookie({ |
|
'name': key, |
|
'value': p[key], |
|
'domain': ".twitch.tv" |
|
}); |
|
} |
|
} |
|
|
|
|
|
casper.start('https://twitch.tv/directory/following', function () { |
|
//casper.echo('Start callback has cookie: ' + JSON.stringify(phantom.cookies)); |
|
this.capture('twitch.png'); |
|
}); |
|
|
|
casper.thenOpen('https://secure.twitch.tv/products/crasskitty/ticket/new?ref=below_video_subscribe_button', function() { |
|
// Wait here for page js to make forms work |
|
casper.wait(5000, function() { |
|
this.echo('should appear after 5s'); |
|
}); |
|
|
|
this.capture('sub.png'); |
|
}); |
|
|
|
casper.then(function() { |
|
|
|
// CC Info here |
|
// Fill these out |
|
this.sendKeys('div.field.first_name input', ''); |
|
this.sendKeys('div.field.last_name input', ''); |
|
this.sendKeys('div.field.email input', ''); |
|
this.sendKeys('div.field.card_number input', ''); |
|
this.sendKeys('div.field.cvv input', ''); |
|
this.sendKeys('div.field.zip input', ''); |
|
|
|
this.fillSelectors('div.month', { |
|
'select': '' |
|
}, false); |
|
|
|
this.fillSelectors('div.month', { |
|
'select': '' |
|
}, false); |
|
|
|
this.click('button.submit.button.primary') |
|
|
|
this.capture('form.png'); |
|
}); |
|
|
|
casper.then(function() { |
|
}); |
|
|
|
casper.run(); |