简体   繁体   中英

appium java click numpad on simulator keyboard

I'm using appium with java language for building IOS automation. So after successfully login i will be directed to TAC page. input TAC

The numpad will be automatically displayed and i have the TAC code separately. if we press the numpad one by one then it will be filled to the "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

Thank you

Did You tried to simply input via sendkeys via webDriver.

Locate identifiers for keyboard, or for individual buttons, and locate them and You can do interactions via sendKeys then

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();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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