# How to press the keys in mobile keyboard

**URL:** <https://forum.robotframework.org/t/how-to-press-the-keys-in-mobile-keyboard/3969>\
**Category:** Appium\
**Created:** [7 June 2022 16:34 UTC](https://forum.robotframework.org/t/how-to-press-the-keys-in-mobile-keyboard/3969 "2022-06-07T16:34:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sandaru](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@Sandaru](https://forum.robotframework.org/u/Sandaru)\
**Post date:** [7 June 2022 16:34 UTC](https://forum.robotframework.org/t/how-to-press-the-keys-in-mobile-keyboard/3969/1 "2022-06-07T16:34:27Z")

</div>

Hi, I’m doing mobile automation with robot framework & Appium. I want to enter the texts & numbers in my application by pressing the mobile keyboard (Screenshot\_01).

 ![Screenshot_01](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/3/33090920af18b890507f09a5f03fec56c3185fef.png)

This is what I have so far,

`\*\*\* Settings \*\*\*

Library AppiumLibrary  
Resource /some/path/Variables.robot

\*\*\* Test Cases \*\*\*

TC\_01\_Login with valid details  
Open Application [http://localhost:4723/wd/hub](http://localhost:4723/wd/hub) platformName=Android deviceName=emulator-5554 app=C:/APK/APK\_File\_Name.apk automationName=Uiautomator2  
sleep 10s

```
# Skip Button
click element //android.widget.TextView[@text="Skip"]
sleep 5s

# Enter the Name
input text ${Locator_Name} xxxxx
sleep 5s
# Continue Button
click element ${Continue_Button}
sleep 10s

# Enter the Mobile Number
click element ${Locator_Mobile}
sleep 25s

```

#############################  
#Try 1

```
# Click No. 0 from the mobile keyboard
click element //android.widget.LinearLayout[@text="0"]
sleep 1s

```

#############################  
#Try 2

```
# Click No. 0 from the mobile keyboard
PRESS KEYCODE None 0
sleep 2s

```

#############################

```
# Next Button
click element ${Next_Button}`

```

Here, First I tried as “Try 1”, and get the below error;  
ValueError: Element locator ‘[//android.widget.LinearLayout](https://android.widget.LinearLayout)[@text=“0”]’ did not match any elements.

Then I deleted the first method and tried as “Try 2”. But it closed the application so that I couldn’t complete the scenario.

Please help to solve this issue. Any guidance and advice will be greatly appreciated!

---

<div class="post-metadata">

**Author:** ![KonraweePra](https://avatars.discourse-cdn.com/v4/letter/k/8797f3/32.png) [@KonraweePra](https://forum.robotframework.org/u/KonraweePra)\
**Post date:** [25 August 2022 04:23 UTC](https://forum.robotframework.org/t/how-to-press-the-keys-in-mobile-keyboard/3969/2 "2022-08-25T04:23:51Z")

</div>

Have you know the answer yet? Would you mind to let me know How to press the enter keys in mobile keyboard, please.

---

<div class="post-metadata">

**Author:** ![Sandaru](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@Sandaru](https://forum.robotframework.org/u/Sandaru)\
**Post date:** [15 October 2022 14:18 UTC](https://forum.robotframework.org/t/how-to-press-the-keys-in-mobile-keyboard/3969/3 "2022-10-15T14:18:05Z")

</div>

@KonraweePra, In this application, here we used the default keyboard. So, I couldn’t press the keys using the “Click Element” and “Press Keycode” keywords. But I was able to do it by clicking the coordinates.  
Here is a sample example, maybe it will be helpful to you.

```
## Enter the keys
# Click on the space button
AppiumLibrary.click element at coordinates 748 2603
sleep 2s
# Click on the letter "g"
AppiumLibrary.click element at coordinates 718 2262
sleep 2s

# Press No. 0
AppiumLibrary.click element at coordinates 532 2599
sleep 1s
# Press No. 7
AppiumLibrary.click element at coordinates 186 2465
sleep 1s

```

---

<div class="post-metadata">

**Author:** ![\_daryl](https://avatars.discourse-cdn.com/v4/letter/_/45deac/32.png) [@\_daryl](https://forum.robotframework.org/u/_daryl)\
**Post date:** [30 January 2023 23:41 UTC](https://forum.robotframework.org/t/how-to-press-the-keys-in-mobile-keyboard/3969/4 "2023-01-30T23:41:42Z")

</div>

Sounds like your fairly happy with the approach you fell on which is great 🙂 Interestingly… did you by chance try one of the Wait Until keywords, over a sleep.

So for example as an approach:  
click of input element \> wait until element is visible (being the keyboard container for example) \> then interact with the buttons \> then click of done \> wait until page doesn’t not contain element (being the keyboard)

I’d imagine you had used the UIAutomationViewer to find you’re locators for the elements?

Happy to help with a more robust approach, as those coordinates might cause problems across different devices or different orientation.

---

<div class="post-metadata">

**Author:** ![RomD](https://avatars.discourse-cdn.com/v4/letter/r/bbce88/32.png) [@RomD](https://forum.robotframework.org/u/RomD)\
**Post date:** [5 August 2023 17:50 UTC](https://forum.robotframework.org/t/how-to-press-the-keys-in-mobile-keyboard/3969/5 "2023-08-05T17:50:31Z")

</div>

Hello daryl, may I know how do managed to make the press keycode works? I tried to find some source but I can’t find any working examples.
