How to add a conditional wait on an element in JavaScript Mocha ?
Hi Matthew!
To add a conditional wait on an element in JavaScript Mocha, you need to use the below code snippet in your automation test script.
const EC = protractor.ExpectedConditions;
waitForElement = async () => {
const present = await yourElement.isPresent();
if (present) {
await browser.wait(EC.elementToBeClickable(yourElement));
await yourElement.sendKeys('something');
}
};