Appium cannot find the same element for the second time

I am fairly new to Appium but I ran into the following problem.
I have an Android application and a page in it which has a label on it. When I first navigate to the page I instruct my test to wait until the label is loaded. When the test navigates to the page for the first time, it works perfectly fine. I do some other actions (open a modify window and press cancel which results in navigating back to the page with the label). In the test the appium should wait again for the label to be loaded. But this time, it waits and in the end it times out because it could not find the element.

  • The label has an id which does not change
  • It’s always present and visible on the page
  • I tried to find the label with XPath as well (using it’s class and text, both are constant) with no luck
  • The label’s text does not change
  • The label’s class does not change

Since then we checked if this happens on other pages as well, and it does. No matter what element we try to wait for to load, the element is not detected at all.

Any suggestion or observation is welcomed.

Thank you!

Can you please show me your code here…so i can give you any proper suggestion

public void waitUntilVisibleElement(final MobileElement element, TimeOutInSeconds seconds) {
if (seconds != null) {
WebDriverWait webDriverWait = new WebDriverWait(driver, seconds.getValue());
} else {
throw new NullPointerException(“TimeOutInSeconds thrown null exception”);

Use above method here TimeOutInSeconds is enum. you can use any int value

Thank you for the answer! :slight_smile:
Unfortunately I don’t think I can export code. We are working in RIDE(python framework) .
But I’ll definitely try your solution.

1 Like

The behavior remains. :frowning:
The test still stucks at the same point. Sometimes it finds the element and sometimes it doesn’t.
Can it be the fault of the Appium python library?

Sorry… i have not use python. i have not knowledge of it