webdriver-manager update-config.json absolute paths

Николай Солдаткин picture Николай Солдаткин · Mar 20, 2017 · Viewed 10.8k times · Source

At webdriver-manager\selenium\update-config.json for "last" and "all" JSON parameters, I have absolute paths. How I can set relative paths to them?

I tried "..\" and ".\" but it's not working. Any ideas?

Answer

cnishina picture cnishina · Mar 22, 2017

Alright, so this is the design of update-config.json, what it is used for and why it is there.

Write update-config.json during update

When a user calls webdriver-manager update, the binaries are downloaded and renamed to include the version number. This allows a user to have multiple versions of a binary in their output directory. Previously around ~2015, the file would be downloaded and the uncompressed file for ChromeDriver name would just be chromedriver (or chromedriver.exe on Windows). Now, we rename to include the version. So if we downloaded version 2.28, the uncompressed file would be chromedriver_2.28

How this is used by Protractor

Previously (~2015), the driver provider for local and directConnect would make assumptions on the filename. So for our previous example, it would assume that the file was chromedriver (or chromedriver.exe on Windows).

There are a couple of issues with appending a version number:

  1. Protractor does not keep track of the version numbers downloaded by webdriver-manager
  2. Previous assumptions worked by using the config.json for the version number; however, this did not allow a user to download custom versions.

So what happens is that we keep track of the "latest" version downloaded. The last version downloaded by webdriver-manager will be used by Protractor. The "all" field was just a list of versions downloaded. I believe when we call "status" these values are used.

Obviously, if you delete the update-config.json but still have the binaries, Protractor will not find the update-config.json. Therefore it won't be able to run local or directConnect and will complain / ask to run webdriver-manager update.

Why this should not be stored in git

Previous comments ask about storing this value. The idea here is that, just like the binaries and caching files, this file is temporary and should not be stored in git. I actually do not understand the use case where a user wants to have a relative path to the update-config.json but if you need to reference it via code then I would do something like lib/driverProviders/local.ts#L43.