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_keys, but in some cases I have to enter values using android keypad i.e digits(1,2,3,4,5,6,7,8,9,0) etc.

Can anyone tell me how to enter these value using keypad?

解决方案

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.

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐