Android - unable to touch/click button off screen

Mobile Testing, Android App Testing.
lstauffer
Posts: 9
Joined: Fri Jan 23, 2015 2:31 pm

Android - unable to touch/click button off screen

Post by lstauffer » Fri Jan 23, 2015 2:46 pm

I am working with a native Android mobile app. The app allows you to enter one or two "things". Each "thing" needs multiple information. For example, if I want to enter a car, then I need to enter some information about that car, such as make, model, year (which are all textfields) and other information about the car that are checkboxes. After entering one "thing", there is a textfield asking for additional "things" to add. At this point, I can enter "1" or "2", etc. so that more textfields and checkboxes appear for the number of "things" to add.

At the bottom of this screen is a button that needs to be clicked to evaluate the information added and move to the next screen for results.

If I enter one "thing", I can touch or click the button at the bottom and everything works perfectly.

If I enter two "things", I'm unable to touch or click the button at the bottom. And I can't figure out why.

I've checked the button to see if the xpath changes, but it doesn't. If I highlight the button after entering 2 "things", Ranorex can find it every time.

The button is at the bottom of the screen, and not in view at the time I need to touch/click it. However, it also isn't in view when I enter the first "thing", and Ranorex can touch the button just fine.

I've tried to swipe up so I can make the button visible, but that doesn't help. I've tried to use the Focus() method on the button, and the Click() method, but nothing seems to work.

I think there may be an issue with focus. I think one of the textfields is still in focus (because it looks like the cursor is on the last textfield).

Any suggestions as to how to touch/click this button on the bottom when nothing else works? Or how to get focus on the button?

Thanks!

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Android - unable to touch/click button off screen

Post by krstcs » Fri Jan 23, 2015 4:08 pm

Ranorex has a cache that is uses to speed up testing. This cache contains the last known position of the element in question. If your screen changes between the time Ranorex first finds the item and when you try to perform an action on the item, Ranorex may not be able to find it.

To get around this you can add a Validate.Exists action against the object just before the Click action. This will force Ranorex to find the item again and re-cache the new results.

It doesn't slow the test down by more than a millisecond or so, and doesn't change the actual results.
Shortcuts usually aren't...

lstauffer
Posts: 9
Joined: Fri Jan 23, 2015 2:31 pm

Re: Android - unable to touch/click button off screen

Post by lstauffer » Thu Jan 29, 2015 4:53 pm

Thank you for the reply.

I will try to find out if the button exists before clicking it. One thing I have found, is depending on the value selected in a drop down, if the first item is selected from the drop down, the button can be touched. If the other value is selected in the drop down, then the button cannot be touched. I'm thinking this is probably because when I recorded the button, the first item was selected in the drop down, not the second item. So, I may need to take a look at the xpath to see if there is something within the path indicating the first item value.

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Android - unable to touch/click button off screen

Post by krstcs » Fri Jan 30, 2015 3:12 pm

Ah, yeah, the button's XPath may be changing when different items are selected in the drop-down. Good catch.
Shortcuts usually aren't...

letterkill
Posts: 5
Joined: Wed Oct 14, 2015 6:24 pm

Re: Android - unable to touch/click button off screen

Post by letterkill » Thu May 31, 2018 9:01 pm

I am having the same problem with the 8.1.1 version.
Is there any news about that?
Thank you

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Android - unable to touch/click button off screen

Post by odklizec » Fri Jun 01, 2018 8:10 am

Hi,

What kind of news are you looking for? Have you tried the steps mentioned in previous posts? Also, what exactly is your problem? You problem may look similar/same, but you know, without more details, there is not much anyone here can do or suggest. Please post the xpath of probematic element, snapshot (not screenshot) taken at time the test is supposed to perform click (you can add an action to create snapshot just before the touch) and exact error you are getting. Thanks.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration