Created
February 14, 2018 19:42
-
-
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.
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
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