1
0
mirror of https://github.com/0rangebananaspy/authelia.git synced 2024-09-14 22:47:21 +07:00
authelia/test/helpers/FillLoginPageAndClick.ts
2019-03-03 11:39:40 +01:00

16 lines
661 B
TypeScript

import SeleniumWebdriver, { WebDriver } from "selenium-webdriver";
export default async function(
driver: WebDriver,
username: string,
password: string,
keepMeLoggedIn: boolean = false) {
await driver.wait(SeleniumWebdriver.until.elementLocated(SeleniumWebdriver.By.id("username")), 5000)
await driver.findElement(SeleniumWebdriver.By.id("username")).sendKeys(username);
await driver.findElement(SeleniumWebdriver.By.id("password")).sendKeys(password);
if (keepMeLoggedIn) {
await driver.findElement(SeleniumWebdriver.By.id("remember-checkbox")).click();
}
await driver.findElement(SeleniumWebdriver.By.tagName("button")).click();
};