I’m running into an issue when running my test on real device iOs (8.1.1) against appium server 1.3.1/1.3.3, certain elements that are present on a screen (being in focus) are not seen by isDisplayed().
Details:
All elements under test have accessibility labels and the following attributes:
enabled: true
visible: false
valid: true
Elements that are not visible to isDisplayed() during test run-time, are visible in Appium Inspector but not visible when switching Show Invisible OFF) and are found by appium server during runtime (see log below).
Questions:
How exactly does isDisplayed() work in such situation?
What differentiates visibility of elements to isDisplayed() when both: visible and not visible have similar element attributes values? For ex., elements that are visible to isDisplayed() during test runtime have the following attributes:
enabled: true
visible: false
valid: true
Elements that are not visible to isDisplayed() during runtime have the following attributes:
enabled: true
visible: false
valid: true
Appium server log:
//I’m looking for presence of a button called “Choose”
info: [debug] Pushing command to appium work queue: “au.getElementByName(‘Choose’)”
info: [debug] Sending command to instruments: au.getElementByName(‘Choose’)
info: [debug] [INST] 2014-11-20 22:25:38 +0000 Debug: evaluation finished
info: [debug] [INST] 2014-11-20 22:25:38 +0000 Debug: responding with:
info: [debug] [INST] 2014-11-20 22:25:38 +0000 Debug: Running system command #144: /Users/bzayats/local/bin/node /Users/Bzayats/local/lib/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{“status”:0,“value”:""}…
info: [debug] [INST] 2014-11-20 22:25:39 +0000 Debug: Got new command 144 from instruments: au.getElementByName(‘Choose’)
info: [debug] [INST] 2014-11-20 22:25:39 +0000 Debug: evaluating au.getElementByName(‘Choose’)
info: [debug] [INST] 2014-11-20 22:25:39 +0000 Debug: evaluation finished
info: [debug] [INST] 2014-11-20 22:25:39 +0000 Debug: Lookup returned [object UIAButton] with the name “Choose” (id: 421).
info: [debug] Socket data received (40 bytes)
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {“status”:0,“value”:{“ELEMENT”:“421”}}
info: [debug] Responding to client with success: {“status”:0,“value”:{“ELEMENT”:“421”},“sessionId”:“e26cbb9a-e1e2-4c9f-9741-3e04a5f8c88a”}
info: <-- POST /wd/hub/session/e26cbb9a-e1e2-4c9f-9741-3e04a5f8c88a/element 200 1252.859 ms - 89 {“status”:0,“value”:{“ELEMENT”:“421”},“sessionId”:“e26cbb9a-e1e2-4c9f-9741-3e04a5f8c88a”}
info: --> GET /wd/hub/session/e26cbb9a-e1e2-4c9f-9741-3e04a5f8c88a/element/421/displayed {}
info: [debug] Pushing command to appium work queue: “au.getElement(‘421’).isDisplayed()”
info: [debug] Sending command to instruments: au.getElement(‘421’).isDisplayed()
info: [debug] [INST] 2014-11-20 22:25:39 +0000 Debug: responding with:
info: [debug] [INST] 2014-11-20 22:25:39 +0000 Debug: Running system command #145: /Users/bzayats/local/bin/node /Users/Bzayats/local/lib/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{“status”:0,“value”:{“ELEMENT”:“421”}}…
info: [debug] [INST] 2014-11-20 22:25:40 +0000 Debug: Got new command 145 from instruments: au.getElement(‘421’).isDisplayed()
info: [debug] [INST] 2014-11-20 22:25:40 +0000 Debug: evaluating au.getElement(‘421’).isDisplayed()
info: [debug] Socket data received (28 bytes)
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {“status”:0,“value”:false}
info: [debug] Responding to client with success: {“status”:0,“value”:false,“sessionId”:“e26cbb9a-e1e2-4c9f-9741-3e04a5f8c88a”}
info: <-- GET /wd/hub/session/e26cbb9a-e1e2-4c9f-9741-3e04a5f8c88a/element/421/displayed 200 1089.151 ms - 77 {“status”:0,“value”:false,“sessionId”:“e26cbb9a-e1e2-4c9f-9741-3e04a5f8c88a”}
Is there any way you share your app with me so I can debug? I’m on the Appium team, [email protected]. We’ll use it internally for testing only and will not share it with anyone.
Not sure if I’ll be able to share the app (not released yet), but I’m talking to devs/management right now to see what can be done there. Regarding the loop idea - I’ve used the waitUntilElementToBeClickable(appPom.getChooseButton()); //which basically waits for the Choose button to be clickable. However, server would fail there since that button would never be returned as a WebElement to the calling method.
@0x1mason
I’ve put a timeout for 10 and 20 sec, and no difference - isDisplayed() still fails to see the element. Once again, the elements I’m trying to get to are not visible by appium’s inspector if to switch “Show Invisible” OFF. I just don’t understand which attribute “Show Invisible” is relying upon to see the elements as visible.
Out of curiosity, I’ve performed same test with isEnabled() instead of isDisplayed(), and got a positivie result:
info: [debug] Pushing command to appium work queue: “au.getElementByName(‘Choose’)”
info: [debug] Sending command to instruments: au.getElementByName(‘Choose’)
info: [debug] [INST] 2014-11-24 22:37:16 +0000 Debug: Got new command 145 from instruments: au.getElementByName(‘Choose’)
info: [debug] [INST] 2014-11-24 22:37:16 +0000 Debug: evaluating au.getElementByName(‘Choose’)
info: [debug] [INST] 2014-11-24 22:37:16 +0000 Debug: evaluation finished
info: [debug] [INST] 2014-11-24 22:37:16 +0000 Debug: Lookup returned [object UIAButton] with the name “Choose” (id: 421).
info: [debug] Socket data received (40 bytes)
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {“status”:0,“value”:{“ELEMENT”:“421”}}
info: [debug] Responding to client with success: {“status”:0,“value”:{“ELEMENT”:“421”},“sessionId”:“079a58c3-e36e-402a-a1ab-1d2b15185ff0”}
info: <-- POST /wd/hub/session/079a58c3-e36e-402a-a1ab-1d2b15185ff0/element 200 1422.958 ms - 89 {“status”:0,“value”:{“ELEMENT”:“421”},“sessionId”:“079a58c3-e36e-402a-a1ab-1d2b15185ff0”}
info: --> GET /wd/hub/session/079a58c3-e36e-402a-a1ab-1d2b15185ff0/element/421/enabled {}
info: [debug] Pushing command to appium work queue: “au.getElement(‘421’).isEnabled() === 1”
info: [debug] Sending command to instruments: au.getElement(‘421’).isEnabled() === 1
info: [debug] [INST] 2014-11-24 22:37:16 +0000 Debug: responding with:
info: [debug] [INST] 2014-11-24 22:37:16 +0000 Debug: Running system command #146: /Users/bzayats/local/bin/node /Users/Bzayats/local/lib/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{“status”:0,“value”:{“ELEMENT”:“421”}}…
info: [debug] [INST] 2014-11-24 22:37:17 +0000 Debug: Got new command 146 from instruments: au.getElement(‘421’).isEnabled() === 1
info: [debug] [INST] 2014-11-24 22:37:17 +0000 Debug: evaluating au.getElement(‘421’).isEnabled() === 1
info: [debug] Socket data received (27 bytes)
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {“status”:0,“value”:true}
I am having similar issue on our app as well.
elementId 24 could not be tapped I get this error intermittently for all clickable elements. Elements are visible and clickable but still fails.
I have an issue with iOS like when need to toggle a button which is not visible on UI .When I try to toggle the button using X-path then element hierarchy is getting changed but the button is not getting toggled , cursor is moving to the button
I tried with appium(1.3.1,1.3.7) which throws same problem
can anyone help me out on this
How can I increase the speed of executing the test-cases because X-path is behaving very slow
Do we have any other methods to access elements in iOS. @dmenezes
Classname:
table = driver.find_element_by_class_name(“UIATableView”)
self._row = table.find_elements_by_class_name(“UIATableCell”)[index]
self._row.click()
I tried above one but it throws exception as driver does not support indexes
I also stuck with same issue button is clickable manually but if I tried to automate it is not clickable because it is clickable=‘false’
Any help or suggestion?
I am facing same issue where i am using appium 1.7 and Xcode 9.3,
when i am trying to inspect element its showing its visible property as false, Please let me know how i can fix it as its a blocker
I’m having this same issue using Xcode 9.3 and Appium 1.7.2. It seems one of the HUDs in the app I’m working on never becomes visible. This is also a blocker for me. Does anyone know of a workaround?
Edit: I’ve moved back to Xcode 9.2 and my tests seem to run successfully again.