Created
November 14, 2012 21:37
-
-
Save dancrew32/4075006 to your computer and use it in GitHub Desktop.
Uber.js, call an UberCab from command line.
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
#!/usr/local/bin/casperjs | |
/* | |
* Uber.js | |
* Call an UberCab from the command line | |
* Usage: | |
* update `email` and `pass` variables to match your uber.com account | |
* ./uber.js <my address> | |
*/ | |
var | |
casper = require('casper').create(), | |
url = 'https://m.uber.com', | |
email = '[email protected]', | |
pass = 'yourpass', | |
args = casper.cli.args, | |
addr = args.length ? args.join(' ') : '130 Battery Street, San Francisco 94111'; | |
casper.start(url) | |
.then(function() { | |
this.fill('form.login', { | |
'cmdParams[email]': email, | |
'cmdParams[password]': pass | |
}, true); | |
}) | |
.then(function() { | |
this.fill('form.dark_box', { | |
'cmdParams[address]': addr | |
}, true); | |
}) | |
.then(function() { | |
this.fill('form.confirm_choice', {}, true); | |
}) | |
.then(function() { | |
this.wait(7000, function() { | |
this.echo('Your ubercab is on the way...'); | |
}); | |
}) | |
.run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment