Need help on sendkeys for Android 6 (Marshmallow)

Hi,

I started working on Android 6 (Marshmallow ), i’m using Appium version 1.14.13.1 . Problem i’m facing here is i’m unable to use sendkeys as soon i call sendkeys method keyboard layout is popping due to this generated Xpaths are getting replaced with new keyboard xpath layout,

please see the attached reference files struct1.txt contains the xml structure before calling sendkeys and struct2.txt contains the xml structure of after calling sendkeys, also i attached corresponding struct1.png and struct2.png
Please assist me on this

struct1.txt (14.0 KB)struct2.txt (7.1 KB)

Please share the UIAutomator view for the said control you want to send keys to.

Hi Umar,

i’ve attached the image of UIAutomator

Have you tried any of the below options to debug your problem

  • Tapping on element first in order to open keyboard and then perform the sendKeys?

  • With the focus on element use command adb shell input text “works” to see if it works outside appium?

  • Appium custom keyboard (it doesn’t show keyboard UI, so it may not affect xml):

    capabilities.setCapability(“unicodeKeyboard”, true);
    capabilities.setCapability(“resetKeyboard”, true);

2 Likes

The app you are testing, is it Native or Hybrid or Mobile Web? If it is other than native than UIAutomator won’t help. Also in no-native case, appium needs to be in Selendroid mode.

http://appium.io/slate/en/master/?java#automating-hybrid-android-apps

Thanks @Telmo_Cardoso your tip worked. Thanks a lot.

1 Like

I am using sendKeys for sending data in the EditText box, but it is failing to do so. Can u suggest some ways to do so?
Its actually not deleting the hinted text, while the new string is getting appended to the partially deleted text.

Thats more tricky. I have some of those in my tests also, depending on the way the edittext is implemented. Its not an appium problem.

Tap on the editbox to gain focus and send command:

adb shell input text 'something'

If it doesn’t work, its the adb itself that cannot send text. I didn’t found any real solution for latests Android OS (on older ones, its possible to use clipboard). On my case I drop it because it was a search field, so I just go through the records to find what I need to proceed.