iOS- Can't locate elements that prompts from the OS

Currently it seems that we can’t locate elements that are related to the OS (see below popup for example).
All other elements of our native app can be successfully located.
In the past it worked fine.
In the below example it seems that the inspector can’t locate the “Allow” button:
Is this is a new bug in the latest Appium server/client lib?

See below log where locating the elements are failing:

[HTTP] <-- POST /wd/hub/session/351fa27d-473b-4e3c-a83a-8afea04fc509/element 500 651 ms - 164
[HTTP] --> POST /wd/hub/session/351fa27d-473b-4e3c-a83a-8afea04fc509/element {“using”:“id”,“value”:“Allow”}
[debug] [MJSONWP] Calling AppiumDriver.findElement() with args: [“id”,“Allow”,“351fa27d-473b-4e3c-a83a-8afea04fc509”]
[debug] [XCUITest] Executing command ‘findElement’
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8100/session/955D494A-22CA-4EE6-B1C7-B6DC4DFF4F80/element] with body: {“using”:“id”,“value”:“Allow”}
[debug] [JSONWP Proxy] Got response with status 200: {“value”:{“using”:“id”,“value”:“Allow”,“description”:“unable to find an element”},“sessionId”:“955D494A-22CA-4EE6-B1C7-B6DC4DFF4F80”,“status”:7}
[HTTP] <-- POST /wd/hub/session/351fa27d-473b-4e3c-a83a-8afea04fc509/element 500 718 ms - 164
[HTTP] --> POST /wd/hub/session/351fa27d-473b-4e3c-a83a-8afea04fc509/element {“using”:“id”,“value”:“Allow”}
[debug] [MJSONWP] Calling AppiumDriver.findElement() with args: [“id”,“Allow”,“351fa27d-473b-4e3c-a83a-8afea04fc509”]
[debug] [XCUITest] Executing command ‘findElement’
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8100/session/955D494A-22CA-4EE6-B1C7-B6DC4DFF4F80/element] with body: {“using”:“id”,“value”:“Allow”}
[debug] [JSONWP Proxy] Got response with status 200: {“value”:{“using”:“id”,“value”:“Allow”,“description”:“unable to find an element”},“sessionId”:“955D494A-22CA-4EE6-B1C7-B6DC4DFF4F80”,“status”:7}
[HTTP] <-- POST /wd/hub/session/351fa27d-473b-4e3c-a83a-8afea04fc509/element 500 618 ms - 164
[HTTP] --> POST /wd/hub/session/351fa27d-473b-4e3c-a83a-8afea04fc509/element {“using”:“id”,“value”:“Allow”}
[debug] [MJSONWP] Calling AppiumDriver.findElement() with args: [“id”,“Allow”,“351fa27d-473b-4e3c-a83a-8afea04fc509”]
[debug] [XCUITest] Executing command ‘findElement’
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8100/session/955D494A-22CA-4EE6-B1C7-B6DC4DFF4F80/element] with body: {“using”:“id”,“value”:“Allow”}
[debug] [JSONWP Proxy] Got response with status 200: {“value”:{“using”:“id”,“value”:“Allow”,“description”:“unable to find an element”},“sessionId”:“955D494A-22CA-4EE6-B1C7-B6DC4DFF4F80”,“status”:7}

Python:

self.driver.switch_to.alert.accept()

this works fine for me.

You Rock!

Worked like a charm…

Can I ask how did you handle the swipe deprecation on Java-Client 5?

Thank you :slight_smile: , glad that it worked for you.

Python: Scroll for iOS

el = self.self.driver.find_element_by_id("locator_id")
self.driver.execute_script('mobile: scroll', {"element": el, "toVisible": True})

Hi,

Do you know how to handle swipe deprecation on Java-Client 5 on Java?

@BB choose any you like from -> Swipe/Scroll best practice with Java-Client 5