借助appium在iPhone上自动执行混合移动应用程序的过程中, 我遇到了以下问题。 我想删除搜索输入框中所有现有的文本。我的设置包括 iPhone8,Mac Mojave,Appium 1.10.0,Selenium 3.13.0和Java客户端6.1.0。但是代码插入了一些图标而不是将其清除。请参考我的代码和图片以供参考。请给我建议解决方案。
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("automationName","XCUITest");
capabilities.setCapability("xcodeConfigFile ","/Path/to/my/config/file/Config.xcconfig");
capabilities.setCapability("bundleId", "com.bundle.id");
capabilities.setCapability("deviceName", "my iPhone");
capabilities.setCapability("app","/Path/to/the/app/under/test/IOSApp.app");
capabilities.setCapability("udid", "udidofmyiphone");
IOSDriver driver = new IOSDriver<>(new
URL("http://127.0.0.1:4723/wd/hub"), capabilities);
String xpath = "xpath of any input text box";
String input = "anything";
driver.findElement(By.xpath(xpath)).sendKeys(input);
//Now when this line of code executes . Image of a telephone and question mark gets inserted in the input box
driver.findElement(By.xpath(xpath)).sendKeys(Keys.CONTROL,"a",Keys.DELETE);