问答 请问一下 appium 为什么定位弹窗要 2 分钟

天空的城 · 2022年01月05日 · 最后由 jack 回复于 2022年01月17日 · 2847 次阅读

[HTTP] {"using":"-android uiautomator","value":"className(\"android.widget.TextView\").text(\"确定\")"}
[debug] [W3C (f723f65b)] Calling AppiumDriver.findElement() with args: ["-android uiautomator","className(\"android.widget.TextView\").text(\"确定\")","f723f65b-5118-4648-ac12-c6db20730ba4"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, css selector, -android uiautomator
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [WD Proxy] Matched '/element' to command name 'findElement'
[debug] [WD Proxy] Proxying [POST /element] to [POST http://127.0.0.1:8201/wd/hub/session/9e1ebfb5-12cf-4b60-ba65-a0cd86e779e9/element] with body: {"strategy":"-android uiautomator","selector":"className(\"android.widget.TextView\").text(\"确定\")","context":"","multiple":false}
[HTTP] --> GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts
[HTTP] {}
[debug] [W3C (7e301b84)] Calling AppiumDriver.getTimeouts() with args: ["7e301b84-b03c-43ec-9b91-604de3b84c13"]
[debug] [W3C (7e301b84)] Responding to client with driver.getTimeouts() result: {"command":0,"implicit":0}
[HTTP] <-- GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts 304 2 ms - -
[HTTP]
[HTTP] --> GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts
[HTTP] {}
[debug] [W3C (7e301b84)] Calling AppiumDriver.getTimeouts() with args: ["7e301b84-b03c-43ec-9b91-604de3b84c13"]
[debug] [W3C (7e301b84)] Responding to client with driver.getTimeouts() result: {"command":0,"implicit":0}
[HTTP] <-- GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts 304 2 ms - -
[HTTP]
[HTTP] --> GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts
[HTTP] {}
[debug] [W3C (7e301b84)] Calling AppiumDriver.getTimeouts() with args: ["7e301b84-b03c-43ec-9b91-604de3b84c13"]
[debug] [W3C (7e301b84)] Responding to client with driver.getTimeouts() result: {"command":0,"implicit":0}
[HTTP] <-- GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts 304 3 ms - -
[HTTP]
[HTTP] --> GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts
[HTTP] {}
[debug] [W3C (7e301b84)] Calling AppiumDriver.getTimeouts() with args: ["7e301b84-b03c-43ec-9b91-604de3b84c13"]
[debug] [W3C (7e301b84)] Responding to client with driver.getTimeouts() result: {"command":0,"implicit":0}
[HTTP] <-- GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts 304 3 ms - -
[HTTP]
[debug] [WD Proxy] Got response with status 200: {"sessionId":"9e1ebfb5-12cf-4b60-ba65-a0cd86e779e9","value":{"ELEMENT":"00000000-0000-08f2-ffff-ffff000002c2","element-6066-11e4-a52e-4f735466cecf":"00000000-0000-08f2-ffff-ffff000002c2"}}
[debug] [W3C (f723f65b)] Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"00000000-0000-08f2-ffff-ffff000002c2","ELEMENT":"00000000-0000-08f2-ffff-ffff000002c2"}
[HTTP] <-- POST /wd/hub/session/f723f65b-5118-4648-ac12-c6db20730ba4/element 200 20425 ms - 137
[HTTP]
[HTTP] --> GET /wd/hub/session/f723f65b-5118-4648-ac12-c6db20730ba4/element/00000000-0000-08f2-ffff-ffff000002c2/displayed
[HTTP] {}
[debug] [W3C (f723f65b)] Calling AppiumDriver.elementDisplayed() with args: ["00000000-0000-08f2-ffff-ffff000002c2","f723f65b-5118-4648-ac12-c6db20730ba4"]
[debug] [WD Proxy] Matched '/element/00000000-0000-08f2-ffff-ffff000002c2/attribute/displayed' to command name 'getAttribute'
[debug] [WD Proxy] Proxying [GET /element/00000000-0000-08f2-ffff-ffff000002c2/attribute/displayed] to [GET http://127.0.0.1:8201/wd/hub/session/9e1ebfb5-12cf-4b60-ba65-a0cd86e779e9/element/00000000-0000-08f2-ffff-ffff000002c2/attribute/displayed] with no body
[HTTP] --> GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts
[HTTP] {}
[debug] [W3C (7e301b84)] Calling AppiumDriver.getTimeouts() with args: ["7e301b84-b03c-43ec-9b91-604de3b84c13"]
[debug] [W3C (7e301b84)] Responding to client with driver.getTimeouts() result: {"command":0,"implicit":0}
[HTTP] <-- GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts 304 2 ms - -
[HTTP]
[HTTP] --> GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts
[HTTP] {}
[debug] [W3C (7e301b84)] Calling AppiumDriver.getTimeouts() with args: ["7e301b84-b03c-43ec-9b91-604de3b84c13"]
[debug] [W3C (7e301b84)] Responding to client with driver.getTimeouts() result: {"command":0,"implicit":0}
[HTTP] <-- GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts 304 2 ms - -
[HTTP]
[HTTP] --> GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts
[HTTP] {}
[debug] [W3C (7e301b84)] Calling AppiumDriver.getTimeouts() with args: ["7e301b84-b03c-43ec-9b91-604de3b84c13"]
[debug] [W3C (7e301b84)] Responding to client with driver.getTimeouts() result: {"command":0,"implicit":0}
[HTTP] <-- GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts 304 3 ms - -
[HTTP]
[HTTP] --> GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts
[HTTP] {}
[debug] [W3C (7e301b84)] Calling AppiumDriver.getTimeouts() with args: ["7e301b84-b03c-43ec-9b91-604de3b84c13"]
[debug] [W3C (7e301b84)] Responding to client with driver.getTimeouts() result: {"command":0,"implicit":0}
[HTTP] <-- GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts 304 2 ms - -
[HTTP]
[HTTP] --> GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts
[HTTP] {}
[debug] [W3C (7e301b84)] Calling AppiumDriver.getTimeouts() with args: ["7e301b84-b03c-43ec-9b91-604de3b84c13"]
[debug] [W3C (7e301b84)] Responding to client with driver.getTimeouts() result: {"command":0,"implicit":0}
[HTTP] <-- GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts 304 2 ms - -
[HTTP]
[HTTP] --> GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts
[HTTP] {}
[debug] [W3C (7e301b84)] Calling AppiumDriver.getTimeouts() with args: ["7e301b84-b03c-43ec-9b91-604de3b84c13"]
[debug] [W3C (7e301b84)] Responding to client with driver.getTimeouts() result: {"command":0,"implicit":0}
[HTTP] <-- GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts 304 5 ms - -
[HTTP]
[HTTP] --> GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts
[HTTP] {}
[debug] [W3C (7e301b84)] Calling AppiumDriver.getTimeouts() with args: ["7e301b84-b03c-43ec-9b91-604de3b84c13"]
[debug] [W3C (7e301b84)] Responding to client with driver.getTimeouts() result: {"command":0,"implicit":0}
[HTTP] <-- GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts 304 2 ms - -
[HTTP]
[debug] [WD Proxy] Got response with status 200: {"sessionId":"9e1ebfb5-12cf-4b60-ba65-a0cd86e779e9","value":"true"}
[debug] [W3C (f723f65b)] Responding to client with driver.elementDisplayed() result: true
[HTTP] <-- GET /wd/hub/session/f723f65b-5118-4648-ac12-c6db20730ba4/element/00000000-0000-08f2-ffff-ffff000002c2/displayed 200 31908 ms - 14
[HTTP]
[HTTP] --> GET /wd/hub/session/f723f65b-5118-4648-ac12-c6db20730ba4/element/00000000-0000-08f2-ffff-ffff000002c2/enabled
[HTTP] {}
[debug] [W3C (f723f65b)] Calling AppiumDriver.elementEnabled() with args: ["00000000-0000-08f2-ffff-ffff000002c2","f723f65b-5118-4648-ac12-c6db20730ba4"]
[debug] [WD Proxy] Matched '/element/00000000-0000-08f2-ffff-ffff000002c2/attribute/enabled' to command name 'getAttribute'
[debug] [WD Proxy] Proxying [GET /element/00000000-0000-08f2-ffff-ffff000002c2/attribute/enabled] to [GET http://127.0.0.1:8201/wd/hub/session/9e1ebfb5-12cf-4b60-ba65-a0cd86e779e9/element/00000000-0000-08f2-ffff-ffff000002c2/attribute/enabled] with no body
[HTTP] --> GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts
[HTTP] {}
[debug] [W3C (7e301b84)] Calling AppiumDriver.getTimeouts() with args: ["7e301b84-b03c-43ec-9b91-604de3b84c13"]
[debug] [W3C (7e301b84)] Responding to client with driver.getTimeouts() result: {"command":0,"implicit":0}
[HTTP] <-- GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts 304 2 ms - -
[HTTP]
[HTTP] --> GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts
[HTTP] {}
[debug] [W3C (7e301b84)] Calling AppiumDriver.getTimeouts() with args: ["7e301b84-b03c-43ec-9b91-604de3b84c13"]
[debug] [W3C (7e301b84)] Responding to client with driver.getTimeouts() result: {"command":0,"implicit":0}
[HTTP] <-- GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts 304 2 ms - -
[HTTP]
[HTTP] --> GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts
[HTTP] {}
[debug] [W3C (7e301b84)] Calling AppiumDriver.getTimeouts() with args: ["7e301b84-b03c-43ec-9b91-604de3b84c13"]
[debug] [W3C (7e301b84)] Responding to client with driver.getTimeouts() result: {"command":0,"implicit":0}
[HTTP] <-- GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts 304 1 ms - -
[HTTP]
[HTTP] --> GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts
[HTTP] {}
[debug] [W3C (7e301b84)] Calling AppiumDriver.getTimeouts() with args: ["7e301b84-b03c-43ec-9b91-604de3b84c13"]
[debug] [W3C (7e301b84)] Responding to client with driver.getTimeouts() result: {"command":0,"implicit":0}
[HTTP] <-- GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts 304 2 ms - -
[HTTP]
[debug] [WD Proxy] Got response with status 200: {"sessionId":"9e1ebfb5-12cf-4b60-ba65-a0cd86e779e9","value":"true"}
[debug] [W3C (f723f65b)] Responding to client with driver.elementEnabled() result: true
[HTTP] <-- GET /wd/hub/session/f723f65b-5118-4648-ac12-c6db20730ba4/element/00000000-0000-08f2-ffff-ffff000002c2/enabled 200 21235 ms - 14
[HTTP]
[HTTP] --> POST /wd/hub/session/f723f65b-5118-4648-ac12-c6db20730ba4/element/00000000-0000-08f2-ffff-ffff000002c2/click
[HTTP] {"id":"00000000-0000-08f2-ffff-ffff000002c2"}
[debug] [W3C (f723f65b)] Calling AppiumDriver.click() with args: ["00000000-0000-08f2-ffff-ffff000002c2","f723f65b-5118-4648-ac12-c6db20730ba4"]
[debug] [WD Proxy] Matched '/element/00000000-0000-08f2-ffff-ffff000002c2/click' to command name 'click'
[debug] [WD Proxy] Proxying [POST /element/00000000-0000-08f2-ffff-ffff000002c2/click] to [POST http://127.0.0.1:8201/wd/hub/session/9e1ebfb5-12cf-4b60-ba65-a0cd86e779e9/element/00000000-0000-08f2-ffff-ffff000002c2/click] with body: {"element":"00000000-0000-08f2-ffff-ffff000002c2"}
[HTTP] --> GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts
[HTTP] {}
[debug] [W3C (7e301b84)] Calling AppiumDriver.getTimeouts() with args: ["7e301b84-b03c-43ec-9b91-604de3b84c13"]
[debug] [W3C (7e301b84)] Responding to client with driver.getTimeouts() result: {"command":0,"implicit":0}
[HTTP] <-- GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts 304 2 ms - -
[HTTP]
[HTTP] --> GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts
[HTTP] {}
[debug] [W3C (7e301b84)] Calling AppiumDriver.getTimeouts() with args: ["7e301b84-b03c-43ec-9b91-604de3b84c13"]
[debug] [W3C (7e301b84)] Responding to client with driver.getTimeouts() result: {"command":0,"implicit":0}
[HTTP] <-- GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts 304 2 ms - -
[HTTP]
[HTTP] --> GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts
[HTTP] {}
[debug] [W3C (7e301b84)] Calling AppiumDriver.getTimeouts() with args: ["7e301b84-b03c-43ec-9b91-604de3b84c13"]
[debug] [W3C (7e301b84)] Responding to client with driver.getTimeouts() result: {"command":0,"implicit":0}
[HTTP] <-- GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts 304 5 ms - -
[HTTP]
[HTTP] --> GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts
[HTTP] {}
[debug] [W3C (7e301b84)] Calling AppiumDriver.getTimeouts() with args: ["7e301b84-b03c-43ec-9b91-604de3b84c13"]
[debug] [W3C (7e301b84)] Responding to client with driver.getTimeouts() result: {"command":0,"implicit":0}
[HTTP] <-- GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts 304 3 ms - -
[HTTP]
[HTTP] --> GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts
[HTTP] {}
[debug] [W3C (7e301b84)] Calling AppiumDriver.getTimeouts() with args: ["7e301b84-b03c-43ec-9b91-604de3b84c13"]
[debug] [W3C (7e301b84)] Responding to client with driver.getTimeouts() result: {"command":0,"implicit":0}
[HTTP] <-- GET /wd/hub/session/7e301b84-b03c-43ec-9b91-604de3b84c13/timeouts 304 2 ms - -
[HTTP]
[debug] [WD Proxy] Got response with status 200: {"sessionId":"9e1ebfb5-12cf-4b60-ba65-a0cd86e779e9","value":null}
[debug] [W3C (f723f65b)] Responding to client with driver.click() result: null
[HTTP] <-- POST /wd/hub/session/f723f65b-5118-4648-ac12-c6db20730ba4/element/00000000-0000-08f2-ffff-ffff000002c2/click 200 22739 ms - 14
[HTTP]
[HTTP] --> POST /wd/hub/session/f723f65b-5118-4648-ac12-c6db20730ba4/element

共收到 16 条回复 时间 点赞


换个定位方法?XPATH 的用, (//*[@text='确定'])

2楼 已删除
3楼 已删除

我试过了 xpath,一样很慢

你用 id name 试试呢

这段日志没有时间戳,看不出每一段的耗时呀,不好给建议。加上时间戳再打印一次?

陈恒捷 回复

日志中有时间的,不好找...

kuangcunhao 回复

没有 id 属性,我用了 name 和 text

天空的城 回复

好久没关注 appium 最新的文档了,没法给很具体的操作建议,只能说下可以参考的排查思路:

1、日志加时间戳,appium server 启动参数里有给日志统一加时间戳的设定的,可以加上。先把时间做下拆分

2、打印 uiautomator 内部日志。之前排查 ios 问题有见到过打印 wda 日志的开关,你可以找找 uiautomator 有没有,有的话把它打开,看 2 分钟内有什么日志,通过日志查看过程中都在干嘛。甚至你打印 logcat 也可以。把 appium 日志里面耗时比较长的 request->response 过程的日志,通过这个地方进一步拆细。

3、查看源码。如果前两步获取的信息都不够充足,无法定位,就去看源码吧,可以重点看 uiautomator driver 部分,

陈恒捷 回复

我加上了时间打印的日志,我找不出什么问题

2022-01-08 01:34:36:316 - [HTTP] 
2022-01-08 01:34:36:324 - [HTTP] --> POST /wd/hub/session/cfecf3f7-0532-42dc-9eb6-6369e4e4e02a/element
2022-01-08 01:34:36:324 - [HTTP] {"using":"-android uiautomator","value":"className(\"android.widget.TextView\").text(\"确定\")"}
2022-01-08 01:34:36:325 - [debug] [W3C (cfecf3f7)] Calling AppiumDriver.findElement() with args: ["-android uiautomator","className(\"android.widget.TextView\").text(\"确定\")","cfecf3f7-0532-42dc-9eb6-6369e4e4e02a"]
2022-01-08 01:34:36:325 - [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, css selector, -android uiautomator
2022-01-08 01:34:36:325 - [debug] [BaseDriver] Waiting up to 0 ms for condition
2022-01-08 01:34:36:326 - [debug] [WD Proxy] Matched '/element' to command name 'findElement'
2022-01-08 01:34:36:326 - [debug] [WD Proxy] Proxying [POST /element] to [POST http://127.0.0.1:8201/wd/hub/session/74b2d304-3843-4dba-98c2-fc0f9438be52/element] with body: {"strategy":"-android uiautomator","selector":"className(\"android.widget.TextView\").text(\"确定\")","context":"","multiple":false}
2022-01-08 01:34:56:510 - [debug] [WD Proxy] Got response with status 200: {"sessionId":"74b2d304-3843-4dba-98c2-fc0f9438be52","value":{"ELEMENT":"00000000-0000-1371-ffff-ffff0000014f","element-6066-11e4-a52e-4f735466cecf":"00000000-0000-1371-ffff-ffff0000014f"}}
2022-01-08 01:34:56:511 - [debug] [W3C (cfecf3f7)] Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"00000000-0000-1371-ffff-ffff0000014f","ELEMENT":"00000000-0000-1371-ffff-ffff0000014f"}
2022-01-08 01:34:56:512 - [HTTP] <-- POST /wd/hub/session/cfecf3f7-0532-42dc-9eb6-6369e4e4e02a/element 200 20188 ms - 137
2022-01-08 01:34:56:512 - [HTTP] 
2022-01-08 01:34:56:518 - [HTTP] --> GET /wd/hub/session/cfecf3f7-0532-42dc-9eb6-6369e4e4e02a/element/00000000-0000-1371-ffff-ffff0000014f/displayed
2022-01-08 01:34:56:518 - [HTTP] {}
2022-01-08 01:34:56:519 - [debug] [W3C (cfecf3f7)] Calling AppiumDriver.elementDisplayed() with args: ["00000000-0000-1371-ffff-ffff0000014f","cfecf3f7-0532-42dc-9eb6-6369e4e4e02a"]
2022-01-08 01:34:56:519 - [debug] [WD Proxy] Matched '/element/00000000-0000-1371-ffff-ffff0000014f/attribute/displayed' to command name 'getAttribute'
2022-01-08 01:34:56:519 - [debug] [WD Proxy] Proxying [GET /element/00000000-0000-1371-ffff-ffff0000014f/attribute/displayed] to [GET http://127.0.0.1:8201/wd/hub/session/74b2d304-3843-4dba-98c2-fc0f9438be52/element/00000000-0000-1371-ffff-ffff0000014f/attribute/displayed] with no body
2022-01-08 01:35:26:871 - [debug] [WD Proxy] Got response with status 200: {"sessionId":"74b2d304-3843-4dba-98c2-fc0f9438be52","value":"true"}
2022-01-08 01:35:26:872 - [debug] [W3C (cfecf3f7)] Responding to client with driver.elementDisplayed() result: true
2022-01-08 01:35:26:874 - [HTTP] <-- GET /wd/hub/session/cfecf3f7-0532-42dc-9eb6-6369e4e4e02a/element/00000000-0000-1371-ffff-ffff0000014f/displayed 200 30356 ms - 14
2022-01-08 01:35:26:874 - [HTTP] 
2022-01-08 01:35:26:878 - [HTTP] --> GET /wd/hub/session/cfecf3f7-0532-42dc-9eb6-6369e4e4e02a/element/00000000-0000-1371-ffff-ffff0000014f/enabled
2022-01-08 01:35:26:878 - [HTTP] {}
2022-01-08 01:35:26:878 - [debug] [W3C (cfecf3f7)] Calling AppiumDriver.elementEnabled() with args: ["00000000-0000-1371-ffff-ffff0000014f","cfecf3f7-0532-42dc-9eb6-6369e4e4e02a"]
2022-01-08 01:35:26:879 - [debug] [WD Proxy] Matched '/element/00000000-0000-1371-ffff-ffff0000014f/attribute/enabled' to command name 'getAttribute'
2022-01-08 01:35:26:879 - [debug] [WD Proxy] Proxying [GET /element/00000000-0000-1371-ffff-ffff0000014f/attribute/enabled] to [GET http://127.0.0.1:8201/wd/hub/session/74b2d304-3843-4dba-98c2-fc0f9438be52/element/00000000-0000-1371-ffff-ffff0000014f/attribute/enabled] with no body
2022-01-08 01:35:46:924 - [debug] [WD Proxy] Got response with status 200: {"sessionId":"74b2d304-3843-4dba-98c2-fc0f9438be52","value":"true"}
2022-01-08 01:35:46:924 - [debug] [W3C (cfecf3f7)] Responding to client with driver.elementEnabled() result: true
2022-01-08 01:35:46:926 - [HTTP] <-- GET /wd/hub/session/cfecf3f7-0532-42dc-9eb6-6369e4e4e02a/element/00000000-0000-1371-ffff-ffff0000014f/enabled 200 20048 ms - 14
2022-01-08 01:35:46:926 - [HTTP] 
2022-01-08 01:35:46:930 - [HTTP] --> POST /wd/hub/session/cfecf3f7-0532-42dc-9eb6-6369e4e4e02a/element/00000000-0000-1371-ffff-ffff0000014f/click
2022-01-08 01:35:46:930 - [HTTP] {"id":"00000000-0000-1371-ffff-ffff0000014f"}
2022-01-08 01:35:46:934 - [debug] [W3C (cfecf3f7)] Calling AppiumDriver.click() with args: ["00000000-0000-1371-ffff-ffff0000014f","cfecf3f7-0532-42dc-9eb6-6369e4e4e02a"]
2022-01-08 01:35:46:934 - [debug] [WD Proxy] Matched '/element/00000000-0000-1371-ffff-ffff0000014f/click' to command name 'click'
2022-01-08 01:35:46:934 - [debug] [WD Proxy] Proxying [POST /element/00000000-0000-1371-ffff-ffff0000014f/click] to [POST http://127.0.0.1:8201/wd/hub/session/74b2d304-3843-4dba-98c2-fc0f9438be52/element/00000000-0000-1371-ffff-ffff0000014f/click] with body: {"element":"00000000-0000-1371-ffff-ffff0000014f"}
2022-01-08 01:36:08:550 - [debug] [WD Proxy] Got response with status 200: {"sessionId":"74b2d304-3843-4dba-98c2-fc0f9438be52","value":null}
2022-01-08 01:36:08:551 - [debug] [W3C (cfecf3f7)] Responding to client with driver.click() result: null
2022-01-08 01:36:08:552 - [HTTP] <-- POST /wd/hub/session/cfecf3f7-0532-42dc-9eb6-6369e4e4e02a/element/00000000-0000-1371-ffff-ffff0000014f/click 200 21622 ms - 14
天空的城 回复

从耗时分布看,从发出请求给 WD Proxy 到收到返回值,基本都需要 20 秒左右,占据了绝大部分耗时:

...
2022-01-08 01:35:26:879 - [debug] [WD Proxy] Proxying [GET /element/00000000-0000-1371-ffff-ffff0000014f/attribute/enabled] to [GET http://127.0.0.1:8201/wd/hub/session/74b2d304-3843-4dba-98c2-fc0f9438be52/element/00000000-0000-1371-ffff-ffff0000014f/attribute/enabled] with no body
2022-01-08 01:35:46:924 - [debug] [WD Proxy] Got response with status 200: {"sessionId":"74b2d304-3843-4dba-98c2-fc0f9438be52","value":"true"}
...

这个耗时有点久,可以结合 logcat 日志看看到底这 20 秒在干嘛。

陈恒捷 回复

谢谢大佬的提示,我不会调 logcat 日志😁

天空的城 回复

额,你百度下怎么采集 android logcat 日志?这个日志收集并不复杂。

确实很慢,我改用原生的写了,快很多

jack 回复

原生的 app 吗

天空的城 回复

原生的 uiautomator,java 写的

jack 回复

这个要怎么改🤔

天空的城 回复

我直接放弃 appium,改用原生的写了。appium 我没找到比较好的离线方案(除了无线 adb,但是我们机器的无线 adb 很不稳定)

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