Skip to content

Instantly share code, notes, and snippets.

@jadonn
Created February 14, 2018 19:42
Show Gist options
  • Save jadonn/50fa22b4c8593b207ed9b631906330dd to your computer and use it in GitHub Desktop.
Save jadonn/50fa22b4c8593b207ed9b631906330dd to your computer and use it in GitHub Desktop.
Really simple script to login to WordPress admin dashboard, navigate to the page editor, change the title, and submit the page. Records a screenshot at the end.
const webdriverio = require('webdriverio');
const options = {
desiredCapabilities: {
browserName: 'chrome',
},
protocol: 'http',
host: 'selenium-host',
logLevel: 'verbose'
};
const client = webdriverio.remote(options);
client
.init()
.url('http://some-wordpress-website.com/wp-admin')
.setValue('#user_login', 'some-user')
.setValue('#user_pass', 'some-password')
.getValue('#user_pass')
.click('#wp-submit')
.click('#menu-pages')
.click('.page-title-action')
.setValue('#title', 'This is an automated page')
.click('#publish')
.saveScreenshot('./page-submit.png')
.end();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment