Guest User

Untitled

a guest
Dec 1st, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. module.exports = {
  2. run(context) {
  3. return context.runWithDriver((driver) => {
  4. return driver.get(context.options.loginUrl)
  5. .then(() => {
  6. const webdriver = context.webdriver;
  7. const until = webdriver.until;
  8. const By = webdriver.By;
  9.  
  10. const userName = context.options.username || 'admin';
  11. const password = context.options.password || 'password';
  12.  
  13. driver.findElement(By.css(context.options.usernameFieldCSS || 'input[name="username"]')).sendKeys(userName);
  14. driver.findElement(By.css(context.options.passwordFieldCSS || 'input[name="password"][type="password"]')).sendKeys(password);
  15. const loginButton = driver.findElement(By.css(context.options.loginButtonCSS || '[type="submit"]')).click();
  16.  
  17. return driver.wait(until.elementLocated(By.css(context.options.postLoginSelectors)), 10000);
  18. });
  19. })
  20. }
  21. };
Add Comment
Please, Sign In to add comment