export async function enterUsername(emailID: string){
const emailField = await browser.findElement(‘xpath’, ‘//*[@id=“username”]’);
await browser.elementSendKeys(emailField[‘ELEMENT’], emailID);
}
export async function enterPassword(password: string){
const passField = await browser.findElement(‘xpath’, ‘//*[@id=“password”]’);
await browser.elementSendKeys(passField[‘ELEMENT’], password);
}
export async function login( emailID: string, password: string ): Promise{
await new Promise((res) => setTimeout(() => res('p1'), 10000));
await enterUsername(emailID);
await enterPassword(password);
const loginBtn = await browser.findElement(‘xpath’, ‘//*[@id=“kc-login”]’);
await driver.elementClick(loginBtn[‘ELEMENT’]);
await new Promise((res) => setTimeout(() => res('p1'), 5000));
}
Can anyone tell me the alternative that I can use in my login() function. I don’t want to use timeout but I have to use because when I click on sign in button it takes me to browser link, which takes time sometimes to load due to which it fails to find the emailID and password IDs.
I am using webdriverIO framework with Appium to automate the testCase for my android device.
Could not able to find any alternative in my case. It will be very helpful if someone can shed some light on this. Thanks