简体   繁体   English

Appium Java单击模拟器键盘上的数字键盘

[英]appium java click numpad on simulator keyboard

I'm using appium with java language for building IOS automation. 我使用Java语言的appium构建IOS自动化。 So after successfully login i will be directed to TAC page. 因此,成功登录后,我将被定向到TAC页面。 input TAC 输入TAC

The numpad will be automatically displayed and i have the TAC code separately. 数字键盘将自动显示,我分别拥有TAC代码。 if we press the numpad one by one then it will be filled to the "o". 如果我们一按一个数字键盘,它将填充到“ o”。 my question is how to make it? 我的问题是怎么做? i have tried 我努力了

Map<String, Object> BackspaceKeyEvent  = new HashMap<String, Object>();
BackspaceKeyEvent.put("key", "8");
getDriver().executeScript("mobile:key:event", BackspaceKeyEvent);

But not working 但不起作用

I just want to system press the number like 1,3,5,2,4,6 at that page 我只想在该页面上按数字1,3,5,2,4,6

Thank you 谢谢

Did You tried to simply input via sendkeys via webDriver. 您是否尝试过简单地通过webDriver通过sendkey输入。

Locate identifiers for keyboard, or for individual buttons, and locate them and You can do interactions via sendKeys then 找到键盘或单个按钮的标识符,然后找到它们,然后可以通过sendKeys进行交互

eg. 例如。

MobileElement element0 = driver.findElement(By.id("num0")));
MobileElement element1 = driver.findElement(By.id("num1")));
MobileElement element2 = driver.findElement(By.id("num2")));

...
MobileElement element9 = driver.findElement(By.id("num1")));

so afterwards just do interactions with elements: 因此,之后只需与元素进行交互即可:

element1.click();
element5.click();
element9.click();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM