Online Training: Web test automation with CodeceptJS. Sign up now!

Use isDisplayed() method in CodeceptJs

Just wanted to share the piece of code that uses the isDisplayed() method to check if the element is exists/displayed

const el =  await this.helpers.WebDriver._locate(locator, false);
isDisplayed = (await el[0].isDisplayed());

Above is just an example. Pls make sure to traverse thru your elements array to produce the correct results.

Thanks,
Kushang