Appium运行速度很快,我无法执行wait命令,请检查下面的appium日志,我正在使用以下等待,感谢您的帮助。
public static void waitForVisible(final By by, int waitTime) {
WebDriverWait wait = new WebDriverWait(driver, TIMEOUT);
for (int attempt = 0; attempt < waitTime; attempt++) {
try {
driver.findElement(by);
break;
} catch (Exception e) {
driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS);
}
}
wait.until(ExpectedConditions.visibilityOfElementLocated(by));
}
debug:transferPageSourceXML命令:&#34; D .. \ adb.exe&#34; -s emulator-5554 pull /data/local/tmp/dump.xml" D .. \ Local \ Temp \ 1-6552-8k.xml&#34; debug:响应客户端并出现错误:{&#34; status&#34;:7,&#34; value&#34;:{&#34; message&#34;:&#34;元素无法位于使用给定搜索参数的页面。&#34;},&#34; sessionId&#34;:&#34; a6be962d-1b18-4447-9e62-511a3d1ca51a&#34;} info:&lt; - POST / wd / hub / session / a6be962d-1b18-4447-9e62-511a3d1ca51a / element 500 2128.246 ms - 164 信息: - &gt; POST / wd / hub / session / a6be962d-1b18-4447-9e62-511a3d1ca51a / timeouts / implicit_wait {&#34; ms&#34;:1000} debug:在/ wd / hub / session / a6be962d-1b18-4447-9e62-511a3d1ca51a / timeouts / implicit_wait发起的Appium请求 info:&lt; - POST / wd / hub / session / a6be962d-1b18-4447-9e62-511a3d1ca51a / timeouts / implicit_wait 200 2.684 ms - 76 {&#34; status&#34;:0,&#34; value&# 34;:空,&#34;的sessionId&#34;:&#34; a6be962d-1b18-4447-9e62-511a3d1ca51a&#34;} debug:使用params收到的请求:{&#34; ms&#34;:1000} debug:将Android隐式等待设置为1000ms debug:成功响应客户:{&#34; status&#34;:0,&#34; value&#34;:null,&#34; sessionId&#34;:&#34; a6be962d-1b18-4447- 9e62-511a3d1ca51a&#34;} debug:在/ wd / hub / session / a6be962d-1b18-4447-9e62-511a3d1ca51a / element处启动的Appium请求 debug:使用params收到的请求:{&#34;使用&#34;:&#34; xpath&#34;,&#34; value&#34;:&#34; // android.widget.FrameLayout [0] / android.widget.LinearLayout [0] /android.widget.FrameLayout [0] /android.widget.LinearLayout [0] /android.widget.RelativeLayout [0] /android.widget.TextView [含有(@Text,&#39 ;主页&#39)]&#34;} debug:将命令推送到appium工作队列:[&#34; dumpWindowHierarchy&#34;] debug:[BOOTSTRAP] [debug]从客户端获取数据:{&#34; cmd&#34;:&#34; action&#34;,&#34; action&#34;:&#34; dumpWindowHierarchy&#34;, &#34; PARAMS&#34;:{}} debug:[BOOTSTRAP] [debug]得到ACTION类型的命令 debug:[BOOTSTRAP] [debug]得到命令动作:dumpWindowHierarchy debug:[BOOTSTRAP] [debug]返回结果:{&#34; value&#34;:true,&#34; status&#34;:0}
答案 0 :(得分:0)
WebDriverWait wait = new WebDriverWait(devicedriver, timeoutInSeconds);
Thread.sleep(3000);
wait.until(ExpectedConditions.elementToBeClickable(By.name(elementName)));
答案 1 :(得分:0)
使用此命令,例如等待5秒钟:
driver.wait(5)