2

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?

Alison R.
  • 4,204
  • 28
  • 33
  • Why do you need this? What is your use case that requires this? – cnishina Mar 20 '17 at 18:52
  • test project is in svn repo. And when other testers update it, they got my paths. – Николай Солдаткин Mar 20 '17 at 21:19
  • So how are other testers planning to use it? Why not expose the webdriver-manager binary from your package.json? – cnishina Mar 20 '17 at 22:55
  • I am encountering the same issue. The update-config.json file is very strange. It appeared after updateded my webdriver-manager and cannot be removed. I want to upload this project to our github, so anyone can use it directly after cloning this project. – Bob Bai Mar 22 '17 at 01:18
  • The `update-config.json` is a generated temporary file and shouldn't be saved to github. I'm not sure why you would want to save that data to github. How are you planning to use this file? Its main purpose is to write the paths so Protractor can easily pick it up and launch the latest versions. – cnishina Mar 22 '17 at 03:06
  • If I delete this file, an error occured when running protractor:Error: No update-config.json found. Run 'webdriver-manager update' to download binaries. – Bob Bai Mar 22 '17 at 06:48
  • Is there any other configuration which has pointed to this file? – Bob Bai Mar 22 '17 at 06:54

2 Answers2

6

You can try to update it like this, it will definitely update it in node_modules/protractor

$./node_modules/protractor/bin/webdriver-manager update
CertainPerformance
  • 356,069
  • 52
  • 309
  • 320
Ashwini Koli
  • 61
  • 1
  • 2
5

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.

cnishina
  • 5,016
  • 1
  • 23
  • 40
  • after I deleted ``update-config.json``, protractor cannot work as you said. It still tried to find it. – Bob Bai Mar 23 '17 at 06:02