简体   繁体   English

Appium Selenium无法发送电话号码键

[英]appium selenium cant send phone number keys

在此处输入图片说明

Hi,Normally I can use the sendkey method but for the MobilePhone element I cant this,.I tried to send key one by one ,part part,or text etc.it didnt work.Could you pls help me? 嗨,通常我可以使用sendkey方法,但是对于MobilePhone元素,我无法做到这一点。我试图一次,一部分或文本等方式发送密钥。它没有用。您能帮我吗? My codes: 我的代码:

List<WebElement> menu22 =driver.findElements(By.className("android.widget.EditText")); 
 menu22.get(3).click();
         ((AndroidDriver) driver).pressKeyCode(AndroidKeyCode.KEYCODE_6);
         ((AndroidDriver) driver).pressKeyCode(AndroidKeyCode.KEYCODE_5);
         ((AndroidDriver) driver).pressKeyCode(AndroidKeyCode.KEYCODE_7);
         ((AndroidDriver) driver).pressKeyCode(AndroidKeyCode.KEYCODE_6);
         ((AndroidDriver) driver).pressKeyCode(AndroidKeyCode.KEYCODE_6);
         ((AndroidDriver) driver).pressKeyCode(AndroidKeyCode.KEYCODE_5);
         ((AndroidDriver) driver).pressKeyCode(AndroidKeyCode.KEYCODE_7);
         ((AndroidDriver) driver).pressKeyCode(AndroidKeyCode.KEYCODE_6);
The other my codes:


List<String> tel = Arrays.asList("5", "4", "5", "8", "5","3", "4", "5", "8", "5");
         for (int i = 0; i < tel.size(); i++) {
             menu22.get(3).sendKeys(tel.get(tel.size()-1-i));
             driver.hideKeyboard();
        }

and the other codes: 和其他代码:

 menu22.get(3).sendKeys("5458650215"));

Please use the following capabilities 请使用以下功能

capabilities.setCapability("unicodeKeyboard", true); abilities.setCapability(“ unicodeKeyboard”,true); capabilities.setCapability("resetKeyboard", true); abilities.setCapability(“ resetKeyboard”,true);

This should helps in hide keyboard, that is, during test execution keyboard doesn't appear at all, soft keys will execute on behalf 这应该有助于隐藏键盘,即在测试执行过程中根本不出现键盘时,软键将代表执行

This happens for some elements in the mobile app. 在移动应用程序中的某些元素上会发生这种情况。 To type in such elements using driver keyboard as below: 要使用驱动程序键盘输入如下元素:

List<WebElement> menu22 =driver.findElements(By.className("android.widget.EditText")); 


menu22.get(3).click();

driver.getKeyboard().sendKeys("Your Text to be typed");

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

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