webdriver-manager update-config.json absolute paths

。_饼干妹妹 提交于 2019-12-25 07:46:56

问题


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?


回答1:


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.




回答2:


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

$./node_modules/protractor/bin/webdriver-manager update


来源:https://stackoverflow.com/questions/42911197/webdriver-manager-update-config-json-absolute-paths

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!