Webdriver设置Chrome属性
1. ChromeDriver加载插件
File file = new File ("files\\youtube.crx");
ChromeOptions options = new ChromeOptions();
options.addExtensions(file);
WebDriver driver = new ChromeDriver(options);
2. ChromeDriver切换浏览器语言
ChromeOptions options = new ChromeOptions();
options.addArguments("--lang=" + "zh-CN");
WebDriver driver = new ChromeDriver(options);
3. ChromeDriver设置启动chrome为默认用户的配置信息(包括书签、扩展程序、代理设置等)
// Windows下
ChromeOptions options = new ChromeOptions();
options.addArguments("user-data-dir=C:/Users/user_name/AppData/Local/Google/Chrome/User Data");
WebDriver driver = new ChromeDriver(options);
4. ChromeDriver设置忽略 Chrome 浏览器证书错误报警提示
ChromeOptions options = new ChromeOptions();
options.addArguments("--test-type", "--ignore-certificate-errors");
WebDriver driver = new ChromeDriver(options); //Or Set chrome browser's capabilities to to accept SSL certificate on runtime.
DesiredCapabilities capability = DesiredCapabilities.chrome();
capability.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
WebDriver driver = new ChromeDriver(capability);
5. ChromeDriver设置Chrome参数使浏览器最大化
ChromeOptions options = new ChromeOptions();
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability("chrome.switches", Arrays.asList("--start-maximized"));
options.addArguments("--test-type", "--start-maximized");
WebDriver driver = new ChromeDriver(options);
Webdriver设置Chrome属性的更多相关文章
- 设置Webdriver启动chrome为默认用户的配置信息
Webdriver 启动Chrome浏览器时,默认是打开一个新用户,而非默认用户.即新用户没有我们安装扩展程序.但在实际应用中,我们会须要 默认用户安装的一些扩展程序,比方对于某些js或者css样式. ...
- selenium webdriver启动Chrome浏览器后无法输入网址的解决办法
通过selenium webdriver启动Chrome浏览器,脚本如下: from selenium import webdriver browser = webdriver.Chrome() br ...
- selenium设置chrome和phantomjs的请求头信息
selenium设置chrome和phantomjs的请求头信息 出于反爬虫也好-跳转到手机端页面也好都需要设置请求头,那么如何进行呢? 目录 一:selenium设置phantomjs请求头: ...
- python selenium设置chrome的下载路径
python可以通过ChromeOptions设置chrome参数,如下载路径等,代码如下(python 3.6.7): #-*-coding=utf-8-*- from selenium impor ...
- [转载]设置Chrome忽略网站证书错误
某些用户可能经常会遇到Chrome浏览器提示网站证书错误的情况,尤其是在Google升级证书检查力度之后,访问Google时已经不能在浏览器界面中忽略证书错误访问. 比如说公司的IT修改过证书就会遇到 ...
- 【Selenium专题】WebDriver启动Chrome浏览器(二)
官方API Constructor Summary ChromeDriver() Creates a new ChromeDriver using the default server configu ...
- 【python+selenium自动化】设置Chrome启动参数
起因:直接用selenium的webdriver启动chrome,会弹出“Chrome正在受到自动软件的控制”,并且窗口较小,是因为chrome没有加载任何配置 解决:点进selenium的Chrom ...
- 通过设置CSS属性让DIV水平居中
通过设置CSS属性让DIV水平居中 ---------------------- <html> <head> <title></title> <m ...
- 两种方法设置disabled属性
//两种方法设置disabled属性 $('#fileup').attr("disabled",true); $('#fileup').attr("disabled&qu ...
随机推荐
- mysql安装innodb插件
可以用 show engines;或者show plugins;来查看mysql> show plugins;+------------+--------+----------------+-- ...
- jquery 基础-Ajax应用
使用load()方案异步请求数据 调用格式:load(url,[data],[callback]) 参数url为加载服务器地址,可选项data参数为请求时发送的数据,callback参数为数据请求成功 ...
- 239. Sliding Window Maximum *HARD* -- 滑动窗口的最大值
Given an array nums, there is a sliding window of size k which is moving from the very left of the a ...
- chrome (failed) net::ERR_INCOMPLETE_CHUNKED_ENCODING ashx 加载图片
chrome (failed) net::ERR_INCOMPLETE_CHUNKED_ENCODING ashx文件加载图片的方法,发现在chrome浏览器里面出了异常: (failed) ne ...
- <context:component-scan>使用说明
Spring组件扫描<context:component-scan/>使用详解 在xml配置了这个标签后,spring可以自动去扫描base-pack下面或者子包下面的java文件,如果扫 ...
- deepin linux字体渲染(转)
<?xml version='1.0'?> <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> <fontconfig> <ma ...
- 【思路】-URL重写
URL重写 重写原理 过程分析 疑惑地方 lookfor app.Request.ApplicationPath如果有子目录的话 这个地方可能会起到作用,暂时不确定 bool flag = url. ...
- solr索引服务器的配置和solrj集成开发总结
一.环境:solr6.2 + jdk1.8 + tomcat8 (solr不同版本需要最低的环境不同) solr6 需要至少jdk1.8 .对应的solr5+jdk1.7+tomcat7 实测 ...
- .htaccess下Flags速查表
Flags是可选参数,当有多个标志同时出现时,彼此间以逗号分隔. 速查表: RewirteRule 标记 含义 描述 R Redirect 发出一个HTTP重定向 F Forbidden 禁止对URL ...
- [并查集] POJ 1703 Find them, Catch them
Find them, Catch them Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 43132 Accepted: ...