Protractor click if displayed is not working using async await. I have tried with the following method:
public static async clickIfDisplayed(targetElement: ElementFinder) {
if (await targetElement.isPresent() && await targetElement.isDisplayed()) {
await PageHelper.click(targetElement);
}
}
The above sometime clicks even if element is not present or displayed. Please help to understand where I am going wrong here.
The following worked well with async-await:
Does this work?