【问题标题】:How to enable chromedriver_autodownload feature in appium?如何在 appium 中启用 chromedriver_autodownload 功能?
【发布时间】:2020-10-24 16:25:26
【问题描述】:

我正在尝试在 android 真实设备中进行自动化测试,但出现以下错误:

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_autodownload 来解决这个问题。所以我关闭了 appium,打开命令提示符,在命令提示符中移动到我有 appium 应用程序的文件夹,然后输入 appium --allow-insecure chromedriver_autodownload 。换句话说,我的 cmd(命令提示符)看起来像这样:C:\Program Files\Appium>appium --allow-insecure chromedriver_autodownload,这引发了以下警告并随后打开了 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 而是 设置,所以我不明白这个错误。正如预期的那样,由于这个错误,我的测试无法执行,我得到了与开头提到的相同的 Chromedriver 兼容性错误。

如果我在使用appium --allow-insecure chromedriver_autodownload 时做错了什么,有人可以告诉我吗?或解决设置文件名错误的方法?或者也许是另一种解决 Chromedriver 兼容性错误的方法,而不是我尝试过的方法?

提前感谢,任何帮助将不胜感激

【问题讨论】:

    标签: android selenium selenium-chromedriver appium


    【解决方案1】:

    您需要添加两个 Desired Capabilities:

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

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

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

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

    【讨论】:

      猜你喜欢
      • 2021-01-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-23
      • 2011-04-17
      • 2019-10-01
      • 2020-09-09
      • 1970-01-01
      相关资源
      最近更新 更多