Appium appium1.3.7 重复查找不存在的控件存在递增延时的情况,请问下可能是什么原因?

414562336 · 2015年05月19日 · 最后由 陈恒捷 回复于 2015年05月19日 · 1491 次阅读

MAC: 10.10.3
APPIUM:1.3.7
XCODE:6.3
SIMULATOR:IOS 8.3

在一个方法中每隔 30s 调用另一个方法,另一个方法对某个控件进行查找,因为调用时那个控件肯定不存在,所以每次都会进入 “LogUtil.info("offline 按钮状态为:OFF");” 这个分支,但看了下日志,发现每查找一次控件,就会出现延时,这个延时是递增的,可以通过关键字 “Waited for” 查找日志。当每次查找时对应控件都存在时,则不会出现类似的递增延时,想问下可能是什么问题?

----------------------------代码 1--------------------------
for(int i = 0; i<halfmin; i++)
{
isbuttononofoffline(river)
Thread.sleep(30000);
LogUtil.info("又播放了 30 秒");
}
----------------------------代码 2--------------------------

public static boolean isbuttononofoffline(AppiumDriver driver)
{
boolean status = false;
try
{

driver.findElementByName("switch_on_bg");
status = true;
LogUtil.info("offline 按钮状态为:ON");

}
catch(NoSuchElementException e)
{
LogUtil.info("offline 按钮状态为:OFF");
}
return status;
}

-------------------------日志-----------------------------

info: [debug] Pushing command to appium work queue: "au.getElementByName('switch_on_bg')"
info: [debug] Sending command to instruments: au.getElementByName('switch_on_bg')
info: [debug] [INST] 2015-05-18 03:43:48 +0000 Debug: Got new command 213 from instruments: au.getElementByName('switch_on_bg')
info: [debug] Socket data received (25 bytes)
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":0,"value":""}
info: [debug] Waited for 219ms so far
info: [debug] [INST] 2015-05-18 03:43:48 +0000 Debug: evaluating au.getElementByName('switch_on_bg')
info: [debug] [INST] 2015-05-18 03:43:48 +0000 Debug: evaluation finished
info: [debug] [INST] 2015-05-18 03:43:48 +0000 Debug: responding with:
info: [debug] [INST] 2015-05-18 03:43:48 +0000 Debug: Running system command #214: /usr/local/bin/node /usr/local/lib/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":""}...
info: [debug] Pushing command to appium work queue: "au.getElementByName('switch_on_bg')"
info: [debug] Sending command to instruments: au.getElementByName('switch_on_bg')
info: [debug] [INST] 2015-05-18 03:43:49 +0000 Debug: Got new command 214 from instruments: au.getElementByName('switch_on_bg')
info: [debug] [INST] 2015-05-18 03:43:49 +0000 Debug: evaluating au.getElementByName('switch_on_bg')
info: [debug] Socket data received (25 bytes)
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":0,"value":""}
info: [debug] Waited for 923ms so far
info: [debug] [INST] 2015-05-18 03:43:49 +0000 Debug: evaluation finished
info: [debug] [INST] 2015-05-18 03:43:49 +0000 Debug: responding with:
info: [debug] [INST] 2015-05-18 03:43:49 +0000 Debug: Running system command #215: /usr/local/bin/node /usr/local/lib/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":""}...
info: [debug] Pushing command to appium work queue: "au.getElementByName('switch_on_bg')"
info: [debug] Sending command to instruments: au.getElementByName('switch_on_bg')
info: [debug] [INST] 2015-05-18 03:43:49 +0000 Debug: Got new command 215 from instruments: au.getElementByName('switch_on_bg')
info: [debug] [INST] 2015-05-18 03:43:49 +0000 Debug: evaluating au.getElementByName('switch_on_bg')
info: [debug] [INST] 2015-05-18 03:43:49 +0000 Debug: evaluation finished
info: [debug] Socket data received (25 bytes)
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":0,"value":""}
info: [debug] Waited for 1619ms so far
info: [debug] [INST] 2015-05-18 03:43:49 +0000 Debug: responding with:
info: [debug] [INST] 2015-05-18 03:43:49 +0000 Debug: Running system command #216: /usr/local/bin/node /usr/local/lib/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":""}...
info: [debug] Pushing command to appium work queue: "au.getElementByName('switch_on_bg')"
info: [debug] Sending command to instruments: au.getElementByName('switch_on_bg')
info: [debug] [INST] 2015-05-18 03:43:50 +0000 Debug: Got new command 216 from instruments: au.getElementByName('switch_on_bg')
info: [debug] [INST] 2015-05-18 03:43:50 +0000 Debug: evaluating au.getElementByName('switch_on_bg')
info: [debug] [INST] 2015-05-18 03:43:50 +0000 Debug: evaluation finished
info: [debug] [INST] 2015-05-18 03:43:50 +0000 Debug: responding with:
info: [debug] Socket data received (25 bytes)
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":0,"value":""}
info: [debug] Waited for 2333ms so far
info: [debug] [INST] 2015-05-18 03:43:50 +0000 Debug: Running system command #217: /usr/local/bin/node /usr/local/lib/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":""}...
info: [debug] Pushing command to appium work queue: "au.getElementByName('switch_on_bg')"
info: [debug] Sending command to instruments: au.getElementByName('switch_on_bg')
info: [debug] [INST] 2015-05-18 03:43:51 +0000 Debug: Got new command 217 from instruments: au.getElementByName('switch_on_bg')
info: [debug] [INST] 2015-05-18 03:43:51 +0000 Debug: evaluating au.getElementByName('switch_on_bg')
info: [debug] [INST] 2015-05-18 03:43:51 +0000 Debug: evaluation finished
info: [debug] [INST] 2015-05-18 03:43:51 +0000 Debug: responding with:
info: [debug] [INST] 2015-05-18 03:43:51 +0000 Debug: Running system command #218: /usr/local/bin/node /usr/local/lib/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":""}...
info: [debug] Socket data received (25 bytes)
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":0,"value":""}
info: [debug] Waited for 3049ms so far
info: [debug] Pushing command to appium work queue: "au.getElementByName('switch_on_bg')"
info: [debug] Sending command to instruments: au.getElementByName('switch_on_bg')

共收到 1 条回复 时间 点赞

代码和日志请使用

代码块

谢谢。

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册