appium版本2.3
java17
运行报错:
Caused by: org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: An unknown server-side error occurred while processing the command. Original error: Could not find a driver for automationName 'UiAutomator2' and platformName 'android'. Have you installed a driver that supports those capabilities? Run 'appium driver list --installed' to see. (Lower-level error: Could not find installed driver to support given caps)
原因:由于没有安装appium driver
使用下面的步骤:
appium driver install uiautomator2
但是出现了下面的报错:
Error: ✖ Encountered an error when installing package: npm command 'install --save-dev --no-progress --no-audit --prefer-offline --omit=peer --save-exact --global-style --no-package-lock appium-uiautomator2-driver --json' failed with code 1.
npm ERR! [22:01:34] Error installing Chromedriver: read ECONNRESET
npm ERR! [22:01:34] Error: read ECONNRESET
npm ERR! [22:01:34] Downloading Chromedriver can be skipped by setting the'APPIUM_SKIP_CHROMEDRIVER_INSTALL' environment variable.
这个日志显示是由于需要设置APPIUM_SKIP_CHROMEDRIVER_INSTALL,但是没说怎么设置。
Downloading Chromedriver can be skipped by setting the'APPIUM_SKIP_CHROMEDRIVER_INSTALL' environment variable.
墙了一下给出了答案:
APPIUM_SKIP_CHROMEDRIVER_INSTALL=1 appium driver install uiautomator2
安装成功;