让 WebDriverManager 下载到特定目录

huangapple go评论79阅读模式
英文:

Have WebDriverManager Download to Specific Directory

问题

我理解以下这行代码会将最新的chromedriver文件放置在~/.cache/selenium...

WebDriverManager.chromedriver().setup();

我的问题是:是否有一种方法可以配置它将文件下载到特定的目录?

举个例子,假设我有一个名为"MyChromeDriver"的目录。我希望WebDriverManager将chromedriver文件放在"MyChromeDriver"目录中,而不带所有额外的子目录。

提前感谢!

英文:

I understand that the following line of code places the latest chromedriver file in ~/.cache/selenium...

WebDriverManager.chromedriver().setup();

My question: Is there a way to configure this to download the file to a specific directory?

As an example, say I have a directory named "MyChromeDriver". I would like WebDriverManager to place the chromedriver file inside "MyChromeDriver" without all the extra sub-directories.

Thank you in advance!

答案1

得分: 1

Sure, here's the translated content:

调用WebDriverManager的方法如下:

WebDriverManager.chromedriver().cachePath("MyChromeDriver").avoidOutputTree().setup();
英文:

Invoke WebDriverManager as follows:

WebDriverManager.chromedriver().cachePath("MyChromeDriver").avoidOutputTree().setup();

huangapple
  • 本文由 发表于 2020年10月17日 07:47:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/64397766.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定