Created
April 5, 2016 02:14
-
-
Save blue1st/89c907a0b93392e2f70def9267180513 to your computer and use it in GitHub Desktop.
あしあとちょろまかし
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var casper = require("casper").create({ | |
viewportSize: { width: 1024, height: 768 } | |
}); | |
casper.userAgent("Mozilla/5.0"); | |
casper.start("https://honto.jp/reg/login.html", function(){ | |
this.echo("ログイン画面"); | |
this.fill('#pbBlock33398 > form', { dy_lginId: '<MAIL ADDRESS>', dy_pw: '<PASSWORD>' }, true); | |
}); | |
casper.then(function(){ | |
this.echo("ログイン"); | |
}); | |
casper.thenOpen('https://honto.jp/my/account/point/footmark.html', function(){ | |
this.echo('足あとページ'); | |
//this.capture('before.png'); | |
this.evaluate(function() { | |
//クリックイベント作成 | |
var click_event = document.createEvent('MouseEvents'); | |
click_event.initEvent('click', false, true); | |
//足あとボタン取得 | |
var footmark_btn = document.querySelector("#pbBlock2525988 > div.stBoxBorder04 > p > a > img"); | |
//押下 | |
footmark_btn.dispatchEvent(click_event); | |
//抽選ボタンのareaタグhref要素に設定されているコマンド文字列を取得 | |
var cmd = document.querySelector("#imgfootMarkLot > area:nth-child(1)").getAttribute('href'); | |
//実行できるように「javascript:」を削る | |
cmd = cmd.replace("javascript:", ""); | |
//コマンド実行 | |
eval(cmd); | |
}); | |
}); | |
casper.then(function(){ | |
this.echo("終了"); | |
//this.capture('after.png'); | |
}); | |
casper.run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment