Page 1 of 2

PressKeys() in Android not working

Posted: Wed Jan 10, 2018 1:38 pm
by ms_infometis
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

Re: PressKeys() in Android not working

Posted: Thu Jan 11, 2018 10:13 pm
by dpFourOFour
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

Re: PressKeys() in Android not working

Posted: Mon Jan 15, 2018 1:26 pm
by garryjoshi
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 :)

Re: PressKeys() in Android not working

Posted: Tue Mar 27, 2018 3:31 pm
by asishr
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. :|

Re: PressKeys() in Android not working

Posted: Wed Mar 28, 2018 1:47 pm
by dpFourOFour
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

Re: PressKeys() in Android not working

Posted: Wed Mar 28, 2018 6:12 pm
by tvu
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.

Re: PressKeys() in Android not working

Posted: Wed May 01, 2019 9:05 pm
by smithclarkson01
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!

tataindicombroadband.in VidMate E sadhana

Re: PressKeys() in Android not working

Posted: Thu May 02, 2019 7:23 am
by odklizec
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.

Re: PressKeys() in Android not working

Posted: Thu May 02, 2019 9:57 pm
by seoking
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

Re: PressKeys() in Android not working

Posted: Fri May 03, 2019 1:09 pm
by odklizec
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/

Re: PressKeys() in Android not working

Posted: Mon Jan 04, 2021 9:28 am
by flisterfour
I have written custom code to access keyboard

AndroidDriver<?> driver = MobileDriverFactory.getDriver()
driver.getKeyboard().sendKeys(Keys.RETURN)

But its not working.

Re: PressKeys() in Android not working

Posted: Fri Apr 23, 2021 7:14 pm
by rareskysix
tvu wrote:
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.
Thanx for sharing the solution it helped me.

Re: PressKeys() in Android not working

Posted: Wed Oct 27, 2021 2:57 pm
by odklizec
its john wrote:
Wed Oct 27, 2021 11:22 am
me also facing this error.
Hi,

So have you tried one of the suggested solutions?

Re: PressKeys() in Android not working

Posted: Mon Nov 01, 2021 1:00 pm
by its john
odklizec wrote:
Wed Oct 27, 2021 2:57 pm
its john wrote:
Wed Oct 27, 2021 11:22 am
me also facing this error.
Hi,

So have you tried one of the suggested solutions?
yes.

Re: PressKeys() in Android not working

Posted: Wed Dec 29, 2021 3:26 pm
by Benjamins
Hi,
My application is running, I would like to press on overview button and then close the application. Please do let me know how do I do this, Katalon recoder or Spy mobile is not able to recognised the overview button (square button on next home button).