Skip to content

Instantly share code, notes, and snippets.

@snorremd
Last active October 29, 2015 19:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snorremd/41689ef6473a25b9d602 to your computer and use it in GitHub Desktop.
Save snorremd/41689ef6473a25b9d602 to your computer and use it in GitHub Desktop.
var webdriverio = require('webdriverio'),
moment = require('moment');
var options = {
desiredCapabilities: {
browserName: 'firefox'
}
};
var password = process.env.FACEBOOK_PASSWORD,
email = process.env.FACEBOOK_EMAIL,
eventDescription =
`Event description here.
Supports multiline strings hooray!`,
date = moment().weekday(5).format('l');
webdriverio
.remote(options)
.init()
.url('https://www.facebook.com/groups/000000000000000/')
.setValue('#email', email)
.setValue('#pass', password)
.click('input[name="login"]')
.click('a[href="/groups/000000000000000/events/"]')
.waitForExist('.fbCalendarHeader .uiHeaderActions > a[role="button"]', 10000)
.click('.fbCalendarHeader .uiHeaderActions > a[role="button"]')
.waitForExist('input[name="title"]', 10000)
.setValue('input[name="title"]', 'Event Name')
.setValue('textarea', eventDescription)
.setValue('input[name="location"]', 'Location Name')
.setValue('input[name="when_dateIntlDisplay"]', date)
.setValue('input[name="when_time_display_time"]', '4:00 pm')
.click('form > div > table > tbody > tr > td:nth-child(2) > button')
.title(function(err, res) {
console.log('Title was: ' + res.value);
})
.end();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment