2019-01-30 15:47:03 +00:00
|
|
|
import SeleniumWebdriver, { WebDriver } from "selenium-webdriver";
|
|
|
|
|
2019-03-03 22:51:52 +00:00
|
|
|
export default async function(driver: WebDriver, fieldName: string, text: string, timeout: number = 5000) {
|
2019-01-30 15:47:03 +00:00
|
|
|
const element = await driver.wait(
|
|
|
|
SeleniumWebdriver.until.elementLocated(
|
2019-03-03 22:51:52 +00:00
|
|
|
SeleniumWebdriver.By.name(fieldName)), timeout)
|
2019-01-30 15:47:03 +00:00
|
|
|
|
|
|
|
await element.sendKeys(text);
|
|
|
|
};
|