admc / wd

A node.js client for webdriver/selenium 2.
Other
1.53k stars 402 forks source link

waitForElementByAccessibilityId - Element condition wasn't satisfied on hidden element #524

Open anton6 opened 6 years ago

anton6 commented 6 years ago

I am using Appium (1.7.2, 1.8.0-beta5) with wd (1.5.0, 1.6.2) to do smoke tests for iOS and Android. (for Android I am using uiautomator2)

The problem: I have two elements, element A and element B. Element B is behind element A.

When I use waitForElementByAccessibilityId (Android) to find element B I get "Element condition wasn't satisfied".

Expected Behaviour: I guess this makes sense since element B is behind element A, but I thought that waitForElementByAccessibilityId would still find the element (even if it's not visible to the eye) since I can see it in the DOM when inspecting. To check it's visibility I would then use wd.asserters.isDisplayed. So it should still find the element but would fail based on the isDisplayed asserter.

When I use waitForElementById on iOS it actually finds the B element and fails based isDisplayed asserter which is the behaviour I was expecting for waitForElementByAccessibilityId.

Does anyone know what the correct behaviour for waitForElementByAccessibilityId vs waitForElementById should be when looking for hidden elements? Thanks for any clarification.