Ionic framework - Javascript Alert is not working in hybrid app

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));
    Alert alert = driver.switchTo().alert();

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?

It’s not the accept that’s failing. In web context can’t see alert at all. Try switching back to native and handling alert.

Thanks for the response, After switching to native it is working as expected. How to identify it is default alert or custom alert ?

This is the best I’ve got: