Skip to content Skip to sidebar Skip to footer

How To Enter Numeric Values Using Mobile Keypad In Android App In Python Script Using Appium

I am writing a python script to automate android application. I want to enter values in text board using mobile keypad. I was able to enter the value in text field using send_key

Solution 1:

try this emailSign = self.driver.find_element_by_class_name("UIATextField") passSign = self.driver.find_element_by_class_name("UIASecureTextField")

    passSign.click()

    emailSign.send_keys(username + carriage_return)
    passSign.send_keys(password + carriage_return)

Solution 2:

I'm not quite sure what you're trying to do here, but you can send keystrokes with selenium:

from selenium.webdriver.commonimport keys
textfield.send_keys(keys.Keys().ENTER)

Where 'textfield' is your text field element. If you look at the Keys class in selenium, you can send any of the keyboard keys. This is useful if you want to hide the keyboard - just send a tab key and it will focus elsewhere.

Solution 3:

Not sure about Python, but this is how I overcome a similar issue from a Java client code.

AndroidDriver driver;
//... then setup driver//... put some text on target text field
textfield.click();
textfield.sendKeys("some content");

//... finally send Enter key
driver.sendKeyEvent(AndroidKeyCode.ENTER);

Check if the Python API offers such enumeration. Hope this helps.

Post a Comment for "How To Enter Numeric Values Using Mobile Keypad In Android App In Python Script Using Appium"