admin管理员组文章数量:1026989
将下载的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");
}
}
将下载的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");
}
}
版权声明:本文标题:selenium中chrome驱动程序chromedriver.exe存放在chrome浏览器的安装目录下 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/jiaocheng/1727391715a739404.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论