robotframework-appiumlibrary
robotframework-appiumlibrary copied to clipboard
page_should_contain_text() and page_should_not_contain_text() unreliable
Just noticed this when comparing old (v1.3.x) code the to the latest one.
This code is a bit unreliable:
if not self._is_text_present(text):
self.log_source(loglevel)
because the logs might contain wrong page source.
What the above does is
-
self._is_text_present(text)
gets page source and checks whether thetext
is present. - If not, then the
self.log_source(loglevel)
gets the page source again and logs it
If the page source is not the same in steps 1 & 2 we'll log wrong page source.
FIX: Get the page source only once and use it for the logs in case of errors (like it was done in the v1.3.x)