什么是ChromeDriver的默认位置,以及在Windows上安装Chrome [英] What is default location of ChromeDriver and for installing Chrome on Windows

查看:624
本文介绍了什么是ChromeDriver的默认位置,以及在Windows上安装Chrome的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在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 (确保它正常工作总是很好)。



以下是您可以设置它的方式(追加到现有值):



然后你可以像下面这样实例化它:

  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 the PATH variable.

If you have it set in the OS PATH variable, you must be able to run it from the command or cmd (it's always good to make sure it's working).

Here's how you can set it (append to the existing value):

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屋!

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