selenium中chrome驱动程序chromedriver.exe存放在chrome浏览器的安装目录下

您所在的位置:网站首页 驱动放到哪个文件夹 selenium中chrome驱动程序chromedriver.exe存放在chrome浏览器的安装目录下

selenium中chrome驱动程序chromedriver.exe存放在chrome浏览器的安装目录下

2024-06-15 22:29| 来源: 网络整理| 查看: 265

       将下载的chrome驱动程序chromedriver.exe复制到chrome浏览器的安装目录下,也就是appication目录下,如:chrome的安装路径是:C:\Users\admin\AppData\Local\Google\Chrome\Application,那么将下载的驱动程序chromedriver.exe复制到: C:\Users\admin\AppData\Local\Google\Chrome\Application 路径下,同时将此路径增加到环境变量path中(我的电脑--》右键——》属性——》高级系统设置——》环境变量——》系统变量——》path)中,

这样就可以不用setProperty来设置驱动程序的路径了,代码如下:

import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class KeywordBrowserChrome { public static void main(String[] args) { WebDriver driver = new ChromeDriver(); driver.get("http://www.baidu.com"); } }

 



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3