PressKeys() in Android not working

Mobile Testing, Android App Testing.
ms_infometis
Posts: 1
Joined: Wed Jan 10, 2018 1:14 pm

PressKeys() in Android not working

Post by ms_infometis » Wed Jan 10, 2018 1:38 pm

Hi

I am trying to automate a Android App. It is based on Angular. To Log in, the user has to enter username and password and then toucht the "Login" button. To set username and password, I need to user the PressKeys - Function, because setting the values to the box will not trigger Angular to bind the content of the boxes to the variables.

Code: Select all

.PressKeys("A");
Also the out-of the box-function "Keypress" does not work and end up in the same error-message.

Unfortunately, this codes produces a "Method not supported" Error. How can I solve this?

thanks
Martin
Attachments
Docbox_Happy_Path.rxrec
Module
(14.45 KiB) Downloaded 16 times
error_not_supported.png
Printscreen
error_not_supported.png (10.41 KiB) Viewed 787 times
docbox.rxsnp
Snapshot
(58.09 KiB) Downloaded 17 times

dpFourOFour
Certified Professional
Certified Professional
Posts: 38
Joined: Mon Dec 12, 2016 9:24 am

Re: PressKeys() in Android not working

Post by dpFourOFour » Thu Jan 11, 2018 10:13 pm

Hi ms_infometis,

You might wanna take a look at this posting iOS mobile web, button is clicked but nothing happens

Basically, you need to call the executeScript method on the username and password field to make sure the text change event gets fired. Also, you might need to change the method since this usually depends on the listener your dev team has implemented. Some possible values are
.change()
.trigger()
.keyup()
.keydown()

Hope that helps!
Best,
DP
Please always include the following information to your posts
  • Ranorex Version
  • OS Version

garryjoshi
Posts: 1
Joined: Mon Jan 15, 2018 1:09 pm

Re: PressKeys() in Android not working

Post by garryjoshi » Mon Jan 15, 2018 1:26 pm

I was encountering same method not supported error; however on performing the ExecuteScript you've provided it worked just fine. Thank you so much @ dpFourOFour :)

asishr
Posts: 4
Joined: Tue Mar 27, 2018 3:24 pm

Re: PressKeys() in Android not working

Post by asishr » Tue Mar 27, 2018 3:31 pm

I still have this .presskeys & Mobile key press errors.
I am in the same situation, even tries the provided solution with execute script did not work for me. We are using ionic(Angular) with xamarin. :|

dpFourOFour
Certified Professional
Certified Professional
Posts: 38
Joined: Mon Dec 12, 2016 9:24 am

Re: PressKeys() in Android not working

Post by dpFourOFour » Wed Mar 28, 2018 1:47 pm

Hi asishr,

As mentioned in my previous posting, the method which needs to be called within the execute script could be different than my examples.
Could you talk to your development team if they have implemented a different eventlistener?

Best,
DP
Please always include the following information to your posts
  • Ranorex Version
  • OS Version

tvu
Posts: 195
Joined: Tue Apr 07, 2015 10:47 pm

Re: PressKeys() in Android not working

Post by tvu » Wed Mar 28, 2018 6:12 pm

Hi ms_infometis,

There are two solutions that worked for me in the past.
  • Perform the mobile key press on a repo item higher up the Xpath. For example, performing it on the mobileapp item or the mobileapp/form item. You must touch the text field for the username / password first to bring it into focus before performing the key press.
  • Use ADB to send the text. Like the first method, you must touch the username / password text field first to bring it into focus. You can send text with the command listed below. Use the ADB.exe file in the Ranorex Bin directory and not from Android Studio.

    adb.exe shell input text YOURTEXTSTRING
Hope that helps.