Hi,
i am trying to write a logic for an alert which is not always shown.
if the alert is shown i will select “No” from the alert. If the alert is not shown i would like to continue to the next button click…
WebElement noteondrosed = driver.findElement(By.id(“com.test.mobiledemo:id/btn_no”));
if (noteondrosed.isDisplayed())
{
noteondrosed.click();
}
else
{
driver.findElement(By.id(“com.test.mobiledemo:id/img_cd_FrontImg”)).click();
}
The above code is failing with the below error
Element info: {Using=id, value=com.test.mobiledemo:id/btn_no}