Fatma
September 28, 2021, 3:24pm
1
Hello,
My tests run under browserstack with appium 1.20.2 and wdio 7.7.3 using javascript.
I need to click on enter in the mobile (android) keyboard after entering a text in a field to go to another page.
I tried this:
driver.pressKeyCode(66);
But nothing happened. I only see the cursor moving inside the field that’s all.
Just to precise the keyboard isn’t shown while the tests are running I don’t know if it’s the reason why nothing happened.
Can anyone help me please?
Thank you
Aleksei
September 28, 2021, 4:16pm
2
try enter test like:
String email = "[email protected] \n"
try tap before into input to appear keyboard and then enter text + tap enter key
Fatma
September 29, 2021, 10:30am
4
Hello,
Thank you for your answer.
Here is what I did:
driver.pressKeyCode(66); in the field
setValue("[email protected] \n");
driver.pressKeyCode(66);
I ve found myself clicking on the Facebook button and the keyboard hasn t shown
Fatma
September 29, 2021, 10:31am
5
I tried this
driver.execute(‘mobile: performEditorAction’, {‘action’: ‘done’});
It hasn t worked
Fatma
September 29, 2021, 12:22pm
7
1.1 No the keyboard doesn’t appear at all
1.2 Yes the cursor starts blinking
The button is “Done”
The keyboard doesn’t appear at all and I am not trying to hide it.
Aleksei
September 29, 2021, 3:21pm
8
so make keyboard to appear with tap on input first and then repeat all tries.
Fatma
September 30, 2021, 3:08pm
9
The keyboard doesn’t appear even when I tap.
Do you know how to show it? or if there is something to add in the config file please?
Aleksei
September 30, 2021, 3:28pm
10
if you tap manually keyboard appears? If - it is = you tap in wrong place.
Fatma
September 30, 2021, 3:38pm
11
Manually I see the keyboard yes. When I tap the email I directly click at the Done button.
Automatically, I tried :
to tap on the field by doing a click on it and then write the email and driver.pressKeyCode(66);
to driver.pressKeyCode(66);
on the field and write the email and driver.pressKeyCode(66);
again
I tried the same thing but with driver.execute(‘mobile: performEditorAction’, {‘action’: ‘done’});
And another time with adding a “\n” at the end of the mail address.
Is the keyboard shown automatically in your project? Could it be an appium issue? I am using the 1.20.2 version.
Aleksei
September 30, 2021, 4:24pm
12
no no. first step we need keyboard to appear. you need tap on input. you have at least following ways:
el.click(). wrong in most cases as click is WEB while on phone we have tap.
tap on element using TouchAction -> https://appium.io/docs/en/writing-running-appium/touch-actions/
tap on element using W3C action (it should be preferably way!) - http://appium.io/docs/en/commands/interactions/actions/
when tap does not work by ANY reason we can always use tap by coordinates that should work 100% on any phone.
if you are with Android phone enable in Developer menu option to show touches - greatly helps to see where tap/click actually happens.
Fatma
October 1, 2021, 2:14pm
13
Hello again
Here is what happens when I tap on the input element:
await browser.touchAction({
action: ‘tap’,
x: 84, y: 485, //position of my input element
});
I also tried this:
driver.touchPerform([
{ action: ‘tap’, options: { x: 84, y: 485}}
]);
Same result. (I got the x and y by doing a getLocation)
My tests should run on browserstack.
Aleksei
October 2, 2021, 11:14am
14
No luck…
Try add capability ‘autoWebview’. Your screen is webView. Try to work with it directy.
Fatma
October 4, 2021, 8:09am
15
It’s not a webview, it’s a native app
Fatma
October 4, 2021, 9:43am
16
Hello,
I finally did it
I just had ti use this command driver.execute('mobile: performEditorAction', {'action': 'Done'});
Thank you for your help