用 touchaction 试试
我也遇到这个问题,开启 oem 解锁没用,我手机是 OPPO findx,在注释掉 resetkeyboard,noreset=false 后可以正常启动。但是会使用到 appium 输入法输入中文,这个要怎么解决
楼主,这个问题解决了么,我也是这问题,一开始一直在执行查找元素,找了估计 30 秒才找到,我是用 id 定位的这个页面 id 是唯一的,
[AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.wendu.kaoyan:id/dg_title","context":"","multiple":false}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.wendu.kaoyan:id/dg_title","context":"","multiple":false}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding 'com.wendu.kaoyan:id/dg_title' using 'ID' with the contextId: '' multiple: false
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.wendu.kaoyan:id/dg_title]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Failed to locate element. Clearing Accessibility cache and retrying.
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding 'com.wendu.kaoyan:id/dg_title' using 'ID' with the contextId: '' multiple: false
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.wendu.kaoyan:id/dg_title]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":7,"value":"No element found"}
[AndroidBootstrap] Received command result from bootstrap
[MJSONWP] Matched JSONWP error code 7 to NoSuchElementError
[W3C] Encountered internal error running command: NoSuchElementError: An element could not be located on the page using the given search parameters.
[W3C] at AndroidDriver.callee$0$0$ (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\appium-android-driver\lib\commands\find.js:75:11)
[W3C] at tryCatch (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
[W3C] at GeneratorFunctionPrototype.invoke as _invoke
[W3C] at GeneratorFunctionPrototype.prototype.(anonymous function) as throw
[W3C] at GeneratorFunctionPrototype.invoke (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
[W3C] at run (C:\Program Files (x86)\Appium\resources\app\webpack:~\babel-polyfill~\core-js\modules\es6.promise.js:75:1)
[W3C] at C:\Program Files (x86)\Appium\resources\app\webpack:~\babel-polyfill~\core-js\modules\es6.promise.js:92:1
[W3C] at flush (C:\Program Files (x86)\Appium\resources\app\webpack:~\babel-polyfill~\core-js\modules_microtask.js:18:1)
[W3C] at process._tickCallback (internal/process/next_tick.js:61:11)
[HTTP] <-- POST /wd/hub/session/8185e0ed-66a7-42d1-837a-13502ef87bd7/element 404 60523 ms - 1599
[HTTP]
[HTTP] --> POST /wd/hub/session/8185e0ed-66a7-42d1-837a-13502ef87bd7/element
[HTTP] {"using":"id","value":"com.wendu.kaoyan:id/ed_serach","sessionId":"8185e0ed-66a7-42d1-837a-13502ef87bd7"}
[W3C] Calling AppiumDriver.findElement() with args: ["id","com.wendu.kaoyan:id/ed_serach","8185e0ed-66a7-42d1-837a-13502ef87bd7"]
[BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[BaseDriver] Waiting up to 60000 ms for condition
[AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.wendu.kaoyan:id/ed_serach","context":"","multiple":false}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.wendu.kaoyan:id/ed_serach","context":"","multiple":false}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding 'com.wendu.kaoyan:id/ed_serach' using 'ID' with the contextId: '' multiple: false
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.wendu.kaoyan:id/ed_serach]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":{"ELEMENT":"19"}}
[AndroidBootstrap] Received command result from bootstrap
[W3C] Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"19"}
[HTTP] <-- POST /wd/hub/session/8185e0ed-66a7-42d1-837a-13502ef87bd7/element 200 27 ms - 54
[HTTP]
[HTTP] --> POST /wd/hub/session/8185e0ed-66a7-42d1-837a-13502ef87bd7/element/19/click
[HTTP] {"id":"19","sessionId":"8185e0ed-66a7-42d1-837a-13502ef87bd7"}
[W3C] Calling AppiumDriver.click() with args: ["19","8185e0ed-66a7-42d1-837a-13502ef87bd7"]
[AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:click","params":{"elementId":"19"}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:click","params":{"elementId":"19"}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: click
[AndroidBootstrap] Received command result from bootstrap
[W3C] Responding to client with driver.click() result: true
[HTTP] <-- POST /wd/hub/session/8185e0ed-66a7-42d1-837a-13502ef87bd7/element/19/click 200 151 ms - 14
[HTTP]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":true}
[HTTP] --> POST /wd/hub/session/8185e0ed-66a7-42d1-837a-13502ef87bd7/timeouts
[HTTP] {"implicit":60000,"sessionId":"8185e0ed-66a7-42d1-837a-13502ef87bd7"}
[W3C] Calling AppiumDriver.timeouts() with args: [null,null,null,null,60000,"8185e0ed-66a7-42d1-837a-13502ef87bd7"]
[BaseDriver] W3C timeout argument: {"implicit":60000}}
[BaseDriver] Set implicit wait to 60000ms
[W3C] Responding to client with driver.timeouts() result: null
[HTTP] <-- POST /wd/hub/session/8185e0ed-66a7-42d1-837a-13502ef87bd7/timeouts 200 2 ms - 14
[HTTP]
[HTTP] --> POST /wd/hub/session/8185e0ed-66a7-42d1-837a-13502ef87bd7/element
[HTTP] {"using":"id","value":"com.wendu.kaoyan:id/ed_serach","sessionId":"8185e0ed-66a7-42d1-837a-13502ef87bd7"}
[W3C] Calling AppiumDriver.findElement() with args: ["id","com.wendu.kaoyan:id/ed_serach","8185e0ed-66a7-42d1-837a-13502ef87bd7"]
[BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[BaseDriver] Waiting up to 60000 ms for condition
[AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.wendu.kaoyan:id/ed_serach","context":"","multiple":false}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.wendu.kaoyan:id/ed_serach","context":"","multiple":false}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding 'com.wendu.kaoyan:id/ed_serach' using 'ID' with the contextId: '' multiple: false
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.wendu.kaoyan:id/ed_serach]
[AndroidBootstrap] Received command result from bootstrap
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":{"ELEMENT":"20"}}
[W3C] Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"20"}
[HTTP] <-- POST /wd/hub/session/8185e0ed-66a7-42d1-837a-13502ef87bd7/element 200 605 ms - 54
可以了,可能一开始改的东西,加多了
我怎么不能执行第一个 if 语句呢,直接打印了