Using getcontext() I am able to switched from native to web context, Can able to automate using web CSS selector. But alert accept is not working
Code snippet:
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30));
wait.until(ExpectedConditions.alertIsPresent());
Alert alert = driver.switchTo().alert();
alert.accept();
Error : org.openqa.selenium.TimeoutException: Expected condition failed: waiting for alert to be present (tried for 30 second(s) with 500 milliseconds interval) Build info: version: ‘4.1.2’, revision: ‘9a5a329c5a’
When switch the context to native app, I am able to access the alert using Xpath
Why I am not able to access using switch alert method in web context?