无法在Android自动化中输入sendkeys值?

时间:2019-06-06 02:06:55

标签: java selenium-webdriver appium

我无法在手机号码字段中输入手机号码。

enter image description here

   AndroidDriver<AndroidElement> driver;
  DesiredCapabilities caps = new DesiredCapabilities();
  caps.setCapability(MobileCapabilityType.DEVICE_NAME, "W89DN7UGWWPBHUJZ");
  caps.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
  caps.setCapability(MobileCapabilityType.PLATFORM_VERSION, "7.0");
  caps.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.app.operator");
  caps.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "com.app.operator.MainActivity");

  driver = new AndroidDriver<AndroidElement>(new URL("http://127.0.0.1:4723/wd/hub"), caps);
  WebElement mobileNo = driver.findElement(By.xpath("//android.widget.EditText[@text='Mobile No']"));
  mobileNo.click();
  mobileNo.sendKeys("9999999999");

0 个答案:

没有答案