Android 如何在appium中启用chromedriver_自动下载功能?

Android 如何在appium中启用chromedriver_自动下载功能?,android,selenium,selenium-chromedriver,appium,Android,Selenium,Selenium Chromedriver,Appium,我正试图在android real设备上进行自动测试,但出现以下错误: Encountered internal error running command: Error: No Chromedriver found that can automate Chrome '83.0.4103'. You could also try to enable automated chromedrivers download server feature. See https://github.com/ap

我正试图在android real设备上进行自动测试,但出现以下错误:

Encountered internal error running command: Error: No Chromedriver found that can automate Chrome '83.0.4103'. You could also try to enable automated chromedrivers download server feature. See https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/web/chromedriver.md for more details
正如您所见,这是一个Chromedriver兼容性问题,因此我开始寻找解决方案,并发现我可以在appium中允许Chromedriver_自动下载来解决这个问题。因此,我关闭了appium,打开命令提示符,将命令提示符移动到我拥有appium应用程序的文件夹中,然后键入
appium--allow unsecure chromedriver_autodownload
。换句话说,我的cmd(命令提示符)看起来是这样的:
C:\Program Files\Appium>Appium——允许不安全的chromedriver\u自动下载
,这会引发以下警告,并随后打开Appium:

 (node:14992) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, rename 'C:\Users\isaac\AppData\Roaming\appium-desktop\Settings-tmp' -> 'C:\Users\isaac\AppData\Roaming\appium-desktop\Settings'
(node:14992) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, rename 'C:\Users\isaac\AppData\Roaming\appium-desktop\Settings-tmp' -> 'C:\Users\isaac\AppData\Roaming\appium-desktop\Settings'
(node:14992) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:14992) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:14992) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:14992) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
如果您看到,前两个实际上是错误,但是我转到了这些错误中提到的路径,看到设置文件并不像错误所说的那样命名为Settings tmp,而是Settings,所以我不理解这个错误。正如预期的那样,由于这个错误,我的测试无法执行,我得到了在开始时提到的相同的Chromedriver兼容性错误

有人能告诉我在使用appium时是否做错了什么吗?允许不安全的chromedriver\u自动下载?还是解决设置文件名错误的方法?或者是另一种解决Chromedriver兼容性错误的方法,而不是我尝试过的方法


提前感谢,我们将非常感谢您的帮助

您需要添加两个所需功能:

chromedriverExecutableDir:Appium服务器主机上可写目录的路径,可从中下载和执行新的Chromedriver二进制文件 Chromedriver ChromeMappingFile:Appium服务器主机上JSON文件的路径,其中将存储Chromedriver版本到Chrome支持的映射

之后,命令行应该可以工作

或者,您可以将AppiumDriverLocalService类实例化为一个新对象,然后指定如下两个参数:

AppiumDriverLocalService service = AppiumDriverLocalService.buildService(new AppiumServiceBuilder().usingAnyFreePort().withArgument(() -> "--allow-insecure","chromedriver_autodownload"));