Last active
December 20, 2015 15:39
-
-
Save toctan/6155338 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
casper = require('casper').create() | |
casper.start 'http://v2ex.com/signin' | |
casper.then -> | |
@fill 'form[action=\"/signin\"]', | |
'u': 'username' | |
'p': 'password' | |
, true | |
casper.waitForUrl /v2ex\.com\/$/, -> | |
if @visible 'a[href=\"/mission/daily\"]' | |
@click 'a[href=\"/mission/daily\"]' | |
else | |
@echo('Today\'s bonus has been claimed.').exit() | |
, -> @echo(@fetchText '.problem ul li').exit() | |
casper.then -> | |
@click '#Main input' | |
casper.then -> | |
throw new Error if @fetchText '.message' isnt '已成功领取每日登录奖励' | |
casper.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment