IOS Safari - Pop Window not identifiable

Hi
Working on Appium 2.11.5
[email protected] (automationName ‘XCUITest’)
iOS 15.5
Safari browser

In my webflow i cam across a pop window and gets the alert message as follows

This site is attempting to open a pop-up window
Block Allow

My capabilities are set as follows
capabilities.setCapability(“platformName”, IOS);
capabilities.setCapability(“deviceName”, “iPhone 15 Pro”);
capabilities.setCapability(“autoWebview”, TRUE_STRING);
capabilities.setCapability(“autoAcceptAlerts”, true);
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, “XCUITest”);
capabilities.setCapability(CapabilityType.BROWSER_NAME, “Safari”);
capabilities.setCapability(“SFSafariViewController”, true);
capabilities.setCapability(“appium:includeSafariInWebviews”, true);
capabilities.setCapability(“safariAllowPopups”, true);
capabilities.setCapability(“waitForIdleTimeout”, 0);
capabilities.setCapability(“isInspectable”, true);
capabilities.setCapability(“webviewConnectTimeout”, 5000);
Log.info("Before iOS capabilities … 1111111 ");

So the alert disapperas automatically after few seconds and the new pop-up window opens

After the new window open ideally i should have get the window size = 2 but it prints window =1.

Problem
But not able to identify any elements in the new pop up window.

While looking for an element in the new pop up window it throws element not found exception … and timed out while waiting for the element to be visible.

Hi
Any update on this issue
Much appreciate if some one can provide an update on this issue.

As presented in the screen … how to avoid or click on Allow button in the given pop up.

The pou up eventually get closed after some time. But the new window opens up is not accessible.

The new window opens is not accessible and elements are not identifyable

When you see the alert, do you switch to it? Like this:

driver.switchTo().alert().accept();

Good info on alert handling here:

Yes i tried but it did not work.
it throws me the following exception
org.openqa.selenium.NoAlertPresentException: An attempt was made to operate on a modal dialog when one was not open

Did this work before, or is it a new issue? Also, what version iOS/Xcode? You aren’t really testing iOS 15.5 are you? Looks like an iPhone 15, so maybe just a mistake?

I am on iOS 17.5
Xcode - 15.4
Xcuitest - 7.1.0
Appium - 2.11.5

dont remember if it worked one earlier versions.
Question here is can the above combination - can we automate with appium with 2 safari browsers?

Short answer yes, that looks fine.

Long answer: I always check the Xcode Wiki for this information, which says it looks good:

You might try adding the iOS version to your capabilities, with the platformVersion capability:

Appied the ios version no use

Window length ======= >>>> 1 [Ljava.lang.Object;@31add542
…WEBVIEW_97973.1
… curtent cotext WEBVIEW_97973.1
Context … NATIVE_APP
Context … WEBVIEW_97973.1

You can clearly see here its only identifying 1 window. Parent window only - window length=1

Oh! Is this pop up in different context? Do you need to switch to NATIVE_APP to handle it? Like switch to NATIVE_APP and then:

driver.switchTo().alert().accept();

This is not working
theere are 2 context here

  1. Mobile app context
  2. Web context where thte browser is open. 2 browser windows
    The new window is not identifiable

((IOSDriver) driver).context(“NATIVE_APP”);
driver.switchTo().alert().accept();

org.openqa.selenium.NoAlertPresentException: An attempt was made to operate on a modal dialog when one was not open

I’m out of ideas. Maybe @mykola-mokhnach can help?

Try appium-xcuitest-driver/docs/guides/troubleshooting.md at master · appium/appium-xcuitest-driver · GitHub