Katalon Studio during autotest refers to interface elements that are not on the active screen of the mobile application

For example, I have this small autotest:

image

When it comes to step 3, the program scrolls down the screen slightly, but does not reach the button that needs to be pressed in the next step. At the same time, in step 4, he still presses a button that is actually not on the screen, because the screen is not scrolled all the way.

This happens when I run this autotest all subsequent times after the first one. It seems that all interface elements scanned earlier are cached in the program and it can access them regardless of whether the element is on the smartphone screen at the moment or not. Or is it a problem with the application being tested itself?

It’s just that when I switch to Mobile Spy mode and start opening various application screens, and then click Capture View, then in the Object Tree (all objects) I see all the page fragments and their elements that I opened earlier, including the elements of the currently open one the screen from which I captured objects.

I asked the Android developers if this could be a problem with our application, for example, that all pages are saved on the stack and therefore Catalon sees them. They said that in our application the memory is constantly cleared and does not store private pages. So what’s the problem then?

2 Likes

Hi,

I found this similar issue; Unable to scroll down text using scrollToText - #7 by Joko_T_Susilo_Widodo. Take a look on it and the instruction : [Mobile] Scroll To Text | Katalon Docs. In the meanwhile, I will investigate on it and back if anything further. Thank you!

3 Likes

Thanks for the tips! But my question was a little different: not about the scrolling function itself, but about the possible caching of interface elements in Catalon and accessing them when they are not visible on the screen. I look forward to information about a possible solution to my problem.

2 Likes

Hi @d.folin
in my case, if I encounter such a scenario first I’ll try to check with Scroll to Text.
As you mentioned scroll to text will work only if the text is unique in the application.

For example in that application screen you have only one text names as Folin scroll to text is the better choice

if the application screen has more than one text name as Folin scroll to text still works but if prefer the first occurrence of Folin while scrolling.

  1. in this case it is better advised to fetch a unique object to the Text
  2. write a loop or a if else to handle it
do
{
WebUI.scroll to Text("Folin")
}
while(WebUI.verifyElementPresent(findTestObject, 0, FailureHandling.OPTIONAL))
WebUI.Click()