appiumappium-iosappium-java

A iOS mobile webelement becoming non clickable when user goes two steps away from the page and try to comeback


I have a Flutter app, which I believe comes under native app on iOS device with Appium 2.0beta66, java_client 8.5, JDK 15.

I have a pageA with with a link A, by clicking which I go in to pageB with 3 links B1,B2,B3, each would take me to pageC Now after clicking link A, going to pageB, I successively click links B1, go to pageC, then come back to pageB by tapping on a back button. So after going to pageC for 3 times by clicking on links B1,B2,B3 one after another, and coming back to pageB each time. Finally after all this exercise was complete, when I am in pageB, I try to click a back button nothing is happening. Also by using the methods isDisplayed(), isEnabled() on the back button, I get is_displayed=false, is_enabled=true but could NOT able to click it. This same back button is working fine, if I go to page B and try to come back to pageA in other test cases. In many other places even though the button exhibits the same attributes nonetheless is clickable. Basically 1 step out and back is working, but 2 steps out and back is NOT working.

I believe, by going through pageA–>pageB–>(3times)pageC, the back button on pageB has lost the reference in the DOM structure. But it is not throwing any StaleElementException??.

I waited on the back button for 20sec, 40sec, but in vain. But it is returning is_displayed=false, is_enabled=true. In many other places even though the button exhibits the same attributes nonetheless is clickable. The locator I was using for this back button are(both not working).Neither any StaleElementException nor any general Exception is thrown.

-

@iOSXCUITFindBy(accessibility = "Back")

public WebElement backBtn;

How to resolve this issue ? Thanks in advance for the help,


Solution

  • An easy but I can't understand why it is work for the sake of God, solution was found. It is calling the same click the back button method twice in succession. wow ! It is working consistently.

    nonClickableBackBtn.click();
    nonClickableBackBtn.click();