什么是ChromeDriver的默认位置,以及在Windows上安装Chrome [英] What is default location of ChromeDriver and for installing Chrome on Windows
问题描述
我需要在Windows操作系统上安装 chromedriver
。在下面的文章中,他们指定了:
https://sites.google.com/a/chromium.org/chromedriver/getting-started
... ChromeDriver希望您将Chrome安装在您的平台的默认
位置...... p>但我不确定默认位置是什么?
在 Mac 操作系统上,
/ usr / local / bin
。
有了这个,我不必明确指定路径或设置系统路径。
如何在Windows操作系统上实现相同的功能?
解决方案对于Selenium必须使用的任何驱动程序浏览器(
chromedriver
,geckodriver
等),您不必担心它的安装位置,因为只要它设置在PATH
变量中。
如果你已经在OS
PATH
变量中设置了它,你必须能够从命令
或cmd
(确保它正常工作总是很好)。
以下是您可以设置它的方式(追加到现有值):
- 文章: https://www.computerhope.com/issues/ch000549.htm
- 视频: https://www.youtube.com/watch?v=dz59GsdvUF8
然后你可以像下面这样实例化它:
WebDriver driver = new FirefoxDriver();
OR
WebDriver driver = new ChromeDriver();
希望这有帮助。
I need to install
chromedriver
on Windows OS. In the article below they specify:https://sites.google.com/a/chromium.org/chromedriver/getting-started
"...ChromeDriver expects you to have Chrome installed in the default location for your platform..."
But I'm not sure what is the default location ?
On Mac OS it's
/usr/local/bin
.With this I don't have to specify path explicitly or setup system path either.
How to achieve the same on Windows OS?
解决方案For any driver that Selenium must use to open the browser (
chromedriver
,geckodriver
, etc), you don't have to worry about where it is installed, as long as it's set in thePATH
variable.If you have it set in the OS
PATH
variable, you must be able to run it from thecommand
orcmd
(it's always good to make sure it's working).Here's how you can set it (append to the existing value):
- Article: https://www.computerhope.com/issues/ch000549.htm
- Video: https://www.youtube.com/watch?v=dz59GsdvUF8
Then you can just instantiate it as follows:
WebDriver driver = new FirefoxDriver();
OR
WebDriver driver = new ChromeDriver();
Hope it's somehow helpful.
这篇关于什么是ChromeDriver的默认位置,以及在Windows上安装Chrome的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!