测试积点老人 发表于 2018-10-15 11:13:11

执行 SendKey 方法是会间歇性的出现失败情况

appium 1.3.4部分脚本:capabilities.setCapability("autoAcceptAlerts", true);
capabilities.setCapability("resetKeyboard", true);
capabilities.setCapability("unicodeKeyboard", true);
capabilities.setCapability("full-reset", true);
driver = new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
报错脚本1:
MobileElement mobileNumber = (MobileElement)driver.findElement(By.xpath("//UIAApplication/UIAWindow/UIATextField"));

mobileNumber.sendKeys("13818181818");
报错脚本2:
MobileElement sms_verify1 = (MobileElement) driver.findElement(By.xpath("//UIAApplication/UIAWindow/UIATextField"));
sms_verify1.sendKeys("8");
MobileElement sms_verify2 = (MobileElement) driver.findElement(By.xpath("//UIAApplication/UIAWindow/UIATextField"));
sms_verify2.sendKeys("8");

MobileElement sms_verify3 = (MobileElement) driver.findElement(By.xpath("//UIAApplication/UIAWindow/UIATextField"));
sms_verify3.sendKeys("8");
MobileElement sms_verify4 = (MobileElement) driver.findElement(By.xpath("//UIAApplication/UIAWindow/UIATextField"));
sms_verify4.sendKeys("8");

报错内容:
Exception in thread "main" org.openqa.selenium.WebDriverException: An error occurred while executing user supplied JavaScript. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2.34 seconds问题描述:
在尝试想text组件中输入内容时,会间歇性的发生错误,虽然配置了resetKeyBoard,但是观察到键盘总会有不弹出的现象,导致用sendKeys失败报错,但有时又可以正常运行。使用setValue虽然不报错,但app会不继续执行。想请问一下是否有其他解决方案。

qqq911 发表于 2018-10-16 11:06:11

加个延迟时间

jingzizx 发表于 2018-10-16 12:20:00

建议添加延迟

梦想家 发表于 2018-10-16 13:36:52

加个延迟

栗子草莓和西瓜 发表于 2018-10-16 16:43:21

添加延迟试一下

libingyu135 发表于 2018-10-16 18:40:58

添加延迟
页: [1]
查看完整版本: 执行 SendKey 方法是会间歇性的出现失败情况