Skip to content

Instantly share code, notes, and snippets.

@dancrew32
Created November 14, 2012 21:37
Show Gist options
  • Save dancrew32/4075006 to your computer and use it in GitHub Desktop.
Save dancrew32/4075006 to your computer and use it in GitHub Desktop.
Uber.js, call an UberCab from command line.
#!/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 = 'you@site.com',
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