Android test hanging in InvokeMethod

Mobile Testing, Android App Testing.
maniek
Posts: 3
Joined: Fri Sep 30, 2016 11:44 am

Android test hanging in InvokeMethod

Post by maniek » Thu Oct 06, 2016 9:35 am

I have this line:

var shown = el.InvokeAction("CallMethod", "isShown");

And I call this A LOT - every time I find an element. The problem is, sometimes (I think mostly when the element has been removed from the screen) the call hangs, I get the 10s timeout. After that, Ranorex loses connection to the app, it must be restarted manually. For example, Ranorex spy can not find the app ("No app running"). This is on Ranorex 6.1.

Is there a workaround? I tried checking "el.IsValid" just before, but it does not help.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Android test hanging in InvokeMethod

Post by Support Team » Fri Oct 07, 2016 2:02 pm

Hi maniek,

Unfortunately, I would need additional information about your test environment. Please do let me know which Android OS version you are testing, which connection type you are using (USB/WiFi) and if you are testing a website or a mobile application.

Generally, please try to be as precise as possible when describing your issues. Provide additional information which might be related to issue as well. This will on the one hand help us in analyzing your issue and on the other hand it will speed up the troubleshooting procedure significantly.

Thank you in advance.

Regards,
Markus (S)

maniek
Posts: 3
Joined: Fri Sep 30, 2016 11:44 am

Re: Android test hanging in InvokeMethod

Post by maniek » Fri Oct 07, 2016 4:50 pm

Android 5.0.2, Galaxy Tab S, USB, Mobile aplication.

This happens in multiple places in the tests. The common denominator seems to be that the call is happening just as the element has disappeared from UI, or perhaps changed.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Android test hanging in InvokeMethod

Post by Support Team » Wed Oct 12, 2016 7:44 am

Hi maniek,

Please excuse the late response.

Ranorex tries to search the element when calling
var shown = el.InvokeAction("CallMethod", "isShown");
Since the element does not exist if it is not visible anymore, the test will time out and throw the find to find item error.

As a workaround, you could use the Exists() method which is available in the item info object.
For example
repo.ComExampleRanorexsample.Button1Info.Exists()
Please do let me know if you have any further questions.

Regards,
Markus (S)

maniek
Posts: 3
Joined: Fri Sep 30, 2016 11:44 am

Re: Android test hanging in InvokeMethod

Post by maniek » Wed Oct 12, 2016 3:01 pm

I want to check if an element is visible. Ranorex also shows invisible elements in the tree.

I tried using the Element.Visible property, but it is unreliable. It sometimes shows actually visible elements as invisible - so I am trying to use the native "isShown" method. It would be nice if you could fix the Android library to not hang.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Android test hanging in InvokeMethod

Post by Support Team » Thu Oct 13, 2016 2:21 pm

Hi maniek,

Thank you for the clarification.

The problem in this intention is that, if you try to access an attribute (isShown) of an element which does not exist at this time, Ranorex will throw an Item not found exception. I assume, your test is not hanging but it is still searching for the element.

Please note that the effective SearchTimeout of an object is a combination of all of the SearchTimeout values of the object itself and all parents. This means if your element is located under 3 parent items and every item has a searchtimeout of 30 seconds, the effective searchtimeout will be 120 seconds.

Parent3: 30 sec
----Parent2: 30 sec
--------Parent1: 30 sec
------------Item: 30 Sec

Total: 120 seconds

Hope that helps to understand the current situation?!

Regards,
Markus (S)