设置配置:
uiautomator2 version : 2.35.0
appium version : 2.3.0
webdriverio version : 8.15.0
node version : 16.18.0
导致问题的代码块:
touchAction
API:
browser.touchAction([
{ action: "press", x: xStart, y: yStart },
{ action: "wait", ms: speed },
{ action: "moveTo", x: xFinish, y: yFinsh },
{ action: "release" }
])
touchPerform
API:
browser.touchPerform([
{ action: "press", options: { x: xStart, y: yStart } },
{ action: "wait", options: { ms: speed } },
{ action: "moveTo", options: { x: xFinish, y: yFinsh } },
{ action: "release", options: {} }
])
错误:
VError: a BeforeAll hook errored, process exiting: node_modules/test-package/dist/test-steps.js:66: Not implemented
at Runtime.runTestRunHooks (/tmp/scratchTyFrlT.scratch/test-packageo45mGa/node_modules/test-package/node_modules/@cucumber/cucumber/lib/runtime/run_test_run_hooks.js:23:23)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Runtime.start (/tmp/scratchTyFrlT.scratch/test-packageo45mGa/node_modules/test-package/node_modules/@cucumber/cucumber/lib/runtime/index.js:53:9)
at async runCucumber (/tmp/scratchTyFrlT.scratch/test-packageo45mGa/node_modules/test-package/node_modules/@cucumber/cucumber/lib/api/run_cucumber.js:106:21) {
jse_shortmsg: 'a BeforeAll hook errored, process exiting: node_modules/test-package/dist/test-steps.js:66',
jse_cause: unknown method: Not implemented
at getErrorFromResponseBody (file:///tmp/scratchTyFrlT.scratch/test-packageo45mGa/node_modules/test-package/node_modules/webdriver/build/utils.js:194:12)
at NodeJSRequest._request (file:///tmp/scratchTyFrlT.scratch/test-packageo45mGa/node_modules/test-package/node_modules/webdriver/build/request/index.js:164:23)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Browser.wrapCommandFn (file:///tmp/scratchTyFrlT.scratch/test-packageo45mGa/node_modules/test-package/node_modules/@wdio/utils/build/shim.js:72:29)
at async Browser.wrapCommandFn (file:///tmp/scratchTyFrlT.scratch/test-packageo45mGa/node_modules/test-package/node_modules/@wdio/utils/build/shim.js:72:29),
jse_info: {},
cause: [Function: ve_cause]
}
我怀疑最新版本的 Appium 驱动程序存在错误
uiautomator2
,因为我也看到了这个问题。通过安装旧版本的 uiautomator2
来解决,如下所述:
Uiautomator 2 导致 «driver.swipe()» 出现问题。这篇文章提到使用 v2.29.4,我发现 v2.29.11 为止都可以工作。我的实验揭示了 v2.30.0 - 最新版 (v2.35.0) 中的欺骗错误。
在 Appium 服务器上修复的步骤:
# Uninstall your latest version of Appium driver
appium driver uninstall uiautomator2
# Install specific version of Appium driver, that doesn't exhibit this issue.
appium driver install [email protected]