Ell-A
Ell-A

Reputation: 1

Mobile app element can suddenly not be found in automated test, has anyone else encountered this?

I am quite new to Appium. Sorry if this question already exists.

I am facing a peculiar issue with finding an element on a page. We are using UISelectors to locate the elements, but the elements on this page suddenly cannot be found with the automated test we have written. The problem occurred about a month ago, before that time the test was running smoothly. The funny thing is: if I manually change pages in the app while the test is waiting to see if the element is visible (which it visually seems to be, but the test is unable to find the element) and return to the page in question, it then finds the elements on the page easily.

The test which is inspecting this page seems to fail about 95% of the time ever since, and we have no clue why it keeps on failing. Our main test developer has looked at the code and was unable to discover why it fails.

The elements can easily be found with Appium Inspector and show up every time we load the page in:

Appium Inspector showcasing the page where the test cannot find the elements

We write our automated tests in C#, and the code to retrieve the element is written as follows:

public AppElement SimCardSubHeader => GetBy(UiSelectors.Text, "Simcard Information");

The element is used for a function, WaitUntilVisible. This function is used to see if an element becomes visible after a set amount of time.

Elements.SimCardSubHeader.WaitUntilVisible(Settings.ExplicitWait, killOnFail: true);

WaitUntilVisible uses IsVisible, where the Driver and Selector are set. We make use of Appium. Our main test developer also looked at everything in the code here, and was unable to find any faults. All other tests are running smoothly, which corresponds to the main test developer not being able to find any errors, and this one seemed to fail suddenly. The error message we receive shows that the element is called correctly:

WaitUntilVisible - failed after waiting for 46466ms with 'ByAndroidUIAutomator(new UiSelector().text("Simcard Information "))' due to: Timed out after 35 seconds.

If I use new UiSelector().text("Simcard Information") in Appium Inspector to locate the element, it works without fail.

Other tests using the exact same functions and ways to retrieve elements are working perfectly fine.

I have used different ways to call upon the element to try and see if that would work:

However, none have worked consistently, and successes could not be replicated. If I switched pages again as described above, then it would always find the element, but if left untouched no elements could be found.

I suspect that – somehow – the elements are loaded within the first few seconds and are then “sweeped under the rug”. Although the app is in constant development, I know that there were no changes made to the app when the error first occurred, and the developers are unable to locate the issue on their side. Has anyone else encountered this problem? We ideally want to avoid using asynchronous functions.

Upvotes: 0

Views: 104

Answers (0)

Related Questions