How to handle refresh with Appium POM #1715
Unanswered
Idoserovitz
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I am using appium POM and I have some issues when the screen is refreshing.
Let's say I have a widget which has a Duration.ofSeconds(30). If I execute:
widget.getSubElement().getText()
- when the test gets to.getText()
it is first locating the 'subElement' inside its proxy and then invoking the getText method on it. Sometimes, while locating the subElement the context inside the proxy is becoming stale. (staleContext.findElement(subElementLocator)). Then a StaleElementReferenceException is being thrown.But, after looking on the client code and more particularly on AppiumElementLocator I saw two things:
Just wanted to ask what is the reason it is implemented that way, what is the logic behind it?
because, for me, if my screen refreshes I need to wait the additional 28 seconds. I overcome this by using a page object/widget instance which has 0 secs lookup duration. Invoking it inside a WebDriverWait instance so it will invoke my Function again whether or not there was a stale context element.
Additionally, what is the right way and how should I handle screen refresh correctly?
It causes me to manage multiple page objects of the same class, each with a different duration...
I though about ways to improve the code, just want to understand first the reason behind 1 and 2 sections mentioned above.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions