Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module.exports = {
- run(context) {
- return context.runWithDriver((driver) => {
- return driver.get(context.options.loginUrl)
- .then(() => {
- const webdriver = context.webdriver;
- const until = webdriver.until;
- const By = webdriver.By;
- const userName = context.options.username || 'admin';
- const password = context.options.password || 'password';
- driver.findElement(By.css(context.options.usernameFieldCSS || 'input[name="username"]')).sendKeys(userName);
- driver.findElement(By.css(context.options.passwordFieldCSS || 'input[name="password"][type="password"]')).sendKeys(password);
- const loginButton = driver.findElement(By.css(context.options.loginButtonCSS || '[type="submit"]')).click();
- return driver.wait(until.elementLocated(By.css(context.options.postLoginSelectors)), 10000);
- });
- })
- }
- };
Add Comment
Please, Sign In to add comment