Software Quality Assurance & Testing Asked by BelovedFool on December 7, 2020
I am currently automating tests for a native app and I have some issues with "ghosts" elements. By "ghosts elements" I mean elements that are in the code and technically on the page but aren’t visible to the user.
I am testing using Android and I don’t know if the issue would also be present with iOS.
Simply put, I want to click on element X but instead I end up clicking on element Y who isn’t visible to the user because X and Y share the same specifications (same text, same element type/class).
I have tried ignoring the element Y by using "isDisplayed()" and "isEnabled()" but it seems like both X and Y are displayed and enabled (even though only X is actually visible to the user).
Is there any way I can discriminate between X and Y using the fact that one is visible to the user and the other isn’t? If possible, I don’t want to ask the devs to change the code of the app.
If it helps, here is how the app ended up with "ghost elements":
Apps open page 1, page 1 has element Y
Apps open page 2, page 2 is different that page 1 but have element X who is the same as element Y from page 1
We are now on page 2 but page 1 didn’t disappear and is just "behind" page 2.
I found this and that who seem to be about the same issue, but there is no solution on how to fix it.
PS: I am using Java but I would accept answers in any language.
I believe the UI has a certain hierarchy and normally object hierarchy has ordered structure (like XML). That means that when you add an element you don't just add it to a random place but to a specific place. Usually it is either the top or the bottom of outer container.
So assume you have the structure like this:
<app>
<page>
<element>bottom</element>
</page>
<page>
<element>top</element>
</page>
</app>
If the new page added is being added to the top, then you can access it with /app/page[1]/element
If the new page added is being added to the bottom, then you can access it with /app/page[last()]/element
Correct answer by Alexey R. on December 7, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP