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 29 times
error_not_supported.png
Printscreen
error_not_supported.png (10.41 KiB) Viewed 1688 times
docbox.rxsnp
Snapshot
(58.09 KiB) Downloaded 28 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.

smithclarkson01
Posts: 1
Joined: Wed May 01, 2019 9:03 pm

Re: PressKeys() in Android not working

Post by smithclarkson01 » Wed May 01, 2019 9:05 pm

garryjoshi wrote:
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 :)
ExecuteScript is not working for me. tried other methods also which I found on other forums. Nothing seems to work!

9Apps VidMate
Last edited by smithclarkson01 on Sun Jul 07, 2019 6:50 pm, edited 1 time in total.

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

Re: PressKeys() in Android not working

Post by odklizec » Thu May 02, 2019 7:23 am

smithclarkson01 wrote:
Wed May 01, 2019 9:05 pm
ExecuteScript is not working for me. tried other methods also which I found on other forums. Nothing seems to work!
Hi,

Without seeing your app under test, or at very least Ranorex snapshot (NOT screenshot), there is unfortunately very little anyone here can do or suggest. Also, you forgot to mention Ranorex version and type of android application you are automating. Generally speaking, if you carefully followed the steps of all mentioned solutions (especially ADB-related), something should work. But as mentioned, without seeing the app (at very least snapshot), it's impossible to tell what's wrong in your case.
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

seoking
Posts: 1
Joined: Mon Apr 29, 2019 1:16 am

Re: PressKeys() in Android not working

Post by seoking » Thu May 02, 2019 9:57 pm

odklizec wrote:
Thu May 02, 2019 7:23 am
smithclarkson01 wrote:
Wed May 01, 2019 9:05 pm
ExecuteScript is not working for me. tried other methods also which I found on other forums. Nothing seems to work!
Hi,

Without seeing your app under test, or at very least Ranorex snapshot (NOT screenshot), there is unfortunately very little anyone here can do or suggest. Also, you forgot to mention Ranorex version and type of android application you are automating. Generally speaking, if you carefully followed the steps of all mentioned solutions (especially ADB-related), something should work. But as mentioned, without seeing the app (at very least snapshot), it's impossible to tell what's wrong in your case.
even for me, I have tried almost everything I could but I think nothings is going to work!! Can you provide me with your email/skype/telegram so that anyone from your team can help me out?

9Apps CArtoon HD SHAREit
Last edited by seoking on Fri May 10, 2019 9:59 pm, edited 1 time in total.

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

Re: PressKeys() in Android not working

Post by odklizec » Fri May 03, 2019 1:09 pm

Hi,

I'm afraid, I'm not a part of Ranorex support team. I'm a normal Ranorex user, just like you ;) So if you want to contact Ranorex support, you should use their support form, available here:
https://www.ranorex.com/support-query/
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