webdriver-manager update-config.json 绝对路径 [英] webdriver-manager update-config.json absolute paths

查看:52
本文介绍了webdriver-manager update-config.json 绝对路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

webdriver-manager\selenium\update-config.json 对于最后"和所有"JSON 参数,我有绝对路径.我如何设置它们的相对路径?

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?

推荐答案

好的,这就是 update-config.json 的设计,它的用途和原因.

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

当用户调用 webdriver-manager update 时,二进制文件被下载并重命名以包含版本号.这允许用户在其输出目录中拥有多个版本的二进制文件.以前大约在 2015 年左右,将下载该文件,ChromeDriver 名称的未压缩文件将仅为 chromedriver(或 Windows 上的 chromedriver.exe).现在,我们重命名以包含版本.所以如果我们下载 2.28 版本,解压后的文件将是 chromedriver_2.28

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

以前(~2015 年),localdirectConnect 的驱动程序提供者会对文件名做出假设.所以对于我们前面的例子,它会假设文件是​​ chromedriver(或 chromedriver.exe 在 Windows 上).

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 不会跟踪 webdriver-manager 下载的版本号
  2. 之前的假设通过使用 config.json 作为版本号;但是,这不允许用户下载自定义版本.

所以我们会跟踪下载的最新"版本.量角器将使用 webdriver-manager 下载的最后一个版本.全部"字段只是下载版本的列表.我相信当我们称其为状态"时,会使用这些值.

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.

显然,如果您删除 update-config.json 但仍有二进制文件,Protractor 将找不到 update-config.json.因此它将无法运行 localdirectConnect 并且会抱怨/要求运行 webdriver-manager update.

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.

之前的评论询问了存储这个值.这里的想法是,就像二进制文件和缓存文件一样,这个文件是临时的,不应存储在 git 中.我实际上不理解用户想要拥有 update-config.json 的相对路径的用例,但是如果您需要通过代码引用它,那么我会做类似 lib/driverProviders/local.ts#L43.

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.

这篇关于webdriver-manager update-config.json 绝对路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆