How to enable chromedriver_autodownload feature in appium?

Viewed 3049

I'm trying to do a an automated test in an android real device but I was getting the following error:

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

As you can see it's a Chromedriver compatibility issue, so I started looking for solutions and found that I could allow chromedriver_autodownload in appium to solve this. So I closed appium, opened the command prompt, moved in the command prompt to the folder where I have the appium application, and typed appium --allow-insecure chromedriver_autodownload . In other words, my cmd (command prompt) looked like this: C:\Program Files\Appium>appium --allow-insecure chromedriver_autodownload , this threw the following warnings and opened appium afterwards:

 (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.

If you see, the first two are actually errors, but I went to the path mentioned in those errors and saw that the Settings file was not named Settings-tmp as the error says but Settings, so I don't understand this error. And as expected due to this errors my test couldn't be executed, I got the same Chromedriver compatibility error mentioned at the begining.

Can someone please tell me if I'm doing something wrong when using appium --allow-insecure chromedriver_autodownload? or a way to solve that Settings file name error? or perhaps another way to solve the Chromedriver compatibility error instead of the one I tried?

Thanks in advance, any help will be greatly appreciated

1 Answers

You'll need to add two Desired Capabilities:

chromedriverExecutableDir: the path to a writable directory on the Appium server's host, where new Chromedriver binaries can be downloaded and executed from chromedriverChromeMappingFile: the path to a JSON file on the Appium server's host, where a mapping will be stored of Chromedriver versions to Chrome support.

After that, the command-line should work.

Alternatively, you can instantiate the AppiumDriverLocalService class as a new object, then specify the two arguments like so:

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