Click on element in alert - ios 15

how I can produce it if the test stops at the time I’m looking for the webElement and the print is right away?

maybe like:

try {
    Thread.sleep(10000); // 10 sec wait for sure
} catch (Exception ignored) {
}
System.out.println(driver.getPageSource());
WebElement el = getDriver().findElement(MobileBy.iOSNsPredicateString("type == 'XCUIElementTypeButton' AND name CONTAINS[cd] 'Call' AND visible == 1"));
el.click();

So that is before
and after

By the way, your work way is that in each page in the app that you are working on, you export the xml and locate elements there?

so with before we need to change:
XCUIElementTypeButton -> XCUIElementTypeStaticText

WebElement el = getDriver().findElement(MobileBy.iOSNsPredicateString("type == 'XCUIElementTypeStaticText' AND name CONTAINS[cd] 'Call' AND visible == 1"));

try

PS Cancel is XCUIElementTypeButton. maybe i just mixed them.

Now it works, Thank you @wreed and @Aleksei,
But I need to know few things,
@Aleksei each page from the app that you are test you take the pagesource or the xml and locate the elements I guess at the browser in that XML?
Second, what is name CONTAINS[cd] ‘Call’

  1. i use page source. i like it better.
  2. https://appium.io/docs/en/writing-running-appium/ios/ios-predicate/

@Aleksei, Thank you, I didn’t know all the Comparisons and the operators of the predicate strings, how it works in the search via the xml with chrome?

it is native XCUITest command -> https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Predicates/Articles/pSyntax.html = ONLY for iOS.

With Chrome use same way as you execute test on web.

Thank you, I will read it all ,
About the chrome, you export it as HTML and search, I know to search with regular locators + CSS and Xpath, but I didn’t know that predicateString is working there and class chain , it is different search?

Predicate only for native iOS screen. With webView it can work if you stay in native contex. But better switch to webView of your app and work in such view like on web.

My app is fully native, it possible to work like in webview ? (If I understand, from the device side)

No. Work in native context then.