appium-uiautomator2-server-v0.x.x.apk does not exist or is not accessible 报错解决方法

命令启动Appium v1.7.1后,使用uiautomator2定位toast,运行代码后报如下错误:

selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: The file at path C:UsersxupjAppDataRoaming pm ode_modulesappium ode_modulesappium-uiautomator2-driveruiautomator2appium-uiautomator2-server-v0.1.8.apk does not exist or is not accessible。

解决方法:

1、根据错误提示进入对应文件夹进行查看是否存在appium-uiautomator2-server-v0.1.8.apk。

路径:C:UsersxupjAppDataRoaming pm ode_modulesappium ode_modulesappium-uiautomator2-driveruiautomator2appium-uiautomator2-server-v0.1.8.apk

2、进入对应文件夹后,发现无uiautomator2文件夹。

3、新建uiautomator2文件夹。

4、下载以下两个文件,放置uiautomator2文件夹中(下载地址:https://github.com/appium/appium-uiautomator2-server/releases/tag/v0.1.8)。

注意:下载的版本号要与报错提示的版本号一致,其他版本可根据下载地址修改版本号即可

https://github.com/appium/appium-uiautomator2-server/releases/tag/v0.x.x)

5、重启appium,再运行代码就OK了。

 

原文地址:https://www.cnblogs.com/yudx/p/11205186.html