如何在Sauce Labs上使用Selenium Automation-Android Emulator在文本框中输入值

时间:2014-10-10 16:01:48

标签: android selenium

虽然在酱汁实验室自动化Android模拟器,但我无法输入值" 123-456-0789"即使我使用了以下代码,也在文本框中;

 //I have checked the web element also.
 driver.findElement(By.id("PatientPhone")).clear();
 driver.findElement(By.id("PatientPhone")).sendKeys("123-456-0789");

1 个答案:

答案 0 :(得分:2)

使用Javascript执行程序并将值设置为其属性。 使用以下代码。希望它能正常工作。

  JavascriptExecutor exe = (JavascriptExecutor) driver;
  String query="$('#PatientPhone').attr('value','123-456-0789')";
  exe.executeScript(query,"");