selenium加载配置参数,让chrome浏览器不出现‘Chrome正在受到自动软件的控制’的提示语,以及后台静默模式启动自动化测试,不占用桌面的方法
一:自动化测试的时候,启动浏览器出现‘Chrome正在受到自动软件的控制’,怎么样隐藏,今天学习分享:
在浏览器配置里加个参数,忽略掉这个警告提示语,disable_infobars
option = webdriver.ChromeOptions() option.add_argument('disable-infobars')
参考代码:
# coding:utf-8
from selenium import webdriver
# 加启动配置
option = webdriver.ChromeOptions()
option.add_argument('disable-infobars')
# 打开chrome浏览器
driver = webdriver.Chrome(chrome_options=option)
driver.get("https://www.baidu.com")
二:启动浏览器的时候不想看的浏览器运行,那就加载浏览器的静默模式,让它在后台偷偷运行。用headless
option = webdriver.ChromeOptions() option.add_argument('headless')
代码如下:
# coding:utf-8
from selenium import webdriver
# 加启动配置
option = webdriver.ChromeOptions()
option.add_argument('headless')
# 打开chrome浏览器
driver = webdriver.Chrome(chrome_options=option)
driver.get("https://www.baidu.com")
转自:https://www.cnblogs.com/yaohanbaby/p/8080880.html
selenium加载配置参数,让chrome浏览器不出现‘Chrome正在受到自动软件的控制’的提示语,以及后台静默模式启动自动化测试,不占用桌面的方法的更多相关文章
- 忽略‘Chrome正在受到自动软件的控制’的提示语,以及后台静默模式启动。
一.使用Chrome做的时候,会看到浏览器上方出现‘Chrome正在受到自动软件的控制’的提示语, 若想忽略此提示信息,在浏览器配置里加个参数:disable_infobars 代码如下 : # co ...
- 2. springboot加载配置参数顺序
加载顺序依次是:1.jar的classes里面的application.properties 2.当前路径下config里面的application.properties 3.jar的classes里 ...
- Python+selenium 自动化-启用带插件的chrome浏览器,调用浏览器带插件,浏览器加载配置信息。
Python+selenium 自动化-启用带插件的chrome浏览器,调用浏览器带插件,浏览器加载配置信息. 本文链接:https://blog.csdn.net/qq_38161040/art ...
- Selenium加载Chrome/Firefox浏览器配置文件
Selenium启动浏览器时,默认是打开一个新用户,不会加载原有的配置以及插件.但有些时候我们可能需要加载默认配置. 一.Chrome浏览器 1.在Chrome浏览器的地址栏输入:chrome://v ...
- Selenium 加载Chrome/Firefox浏览器配置文件
Selenium启动浏览器时,默认是打开一个新用户,不会加载原有的配置以及插件.但有些时候我们可能需要加载默认配置. 一.Chrome浏览器 1.在Chrome浏览器的地址栏输入:chrome://v ...
- 【转】Selenium 加载Chrome/Firefox浏览器配置文件
原文地址:https://www.cnblogs.com/eastonliu/p/9083982.html Selenium启动浏览器时,默认是打开一个新用户,不会加载原有的配置以及插件.但有些时候我 ...
- 自动化测试-14.selenium加载FireFox配置
前言 有小伙伴在用脚本启动浏览器时候发现原来下载的插件不见了,无法用firebug在打开的页面上继续定位页面元素,调试起来不方便 . 加载浏览器配置,需要用FirefoxProfile(profile ...
- webdriver 启动chrome时加载配置
Selenium操作浏览器是不加载任何配置的,网上找了半天,关于Firefox加载配置的多点,Chrome资料很少,下面是关于加载Chrome配置的方法: 一.加载所有Chrome配置 用Chrom ...
- selenium加载时间过长
为了获取网站js渲染后的html,需要利用selenium加载网站,但是会出现加载时间过长的现象,因此可以限制其加载时间以及强制关掉加载: # !/usr/bin/python3.4 # -*- co ...
随机推荐
- wpa_supplicant 的编译
1. wpa_supplicant的编译需要用到的3个源码包, 分别是wpa_supplicant, openssl, libnl wpa_supplicant的下载地址:http://w1.fi/r ...
- java中的HMAC-SHA1加密
public class Sha1Util { private static final String MAC_NAME = "HmacSHA1"; private static ...
- laravel 目录权限
chown -R www:www /data/wwwroot #变更目录所有者并向下传递 find /data/wwwroot/ -type d -exec chmod 755 {} \; # ...
- Caused by: java.lang.ClassCastException: org.springframework.web.SpringServletContainerInitializer cannot be cast to javax.servlet.ServletContainerInitializer
A child container failed during startjava.util.concurrent.ExecutionException: org.apache.catalina.Li ...
- LAMP构架搭建论坛
安装MYSQL数据库服务程序 LAMP动态网站部署架构是一套由Linux+Nginx+MYSQL+PHP组成的动态网站系统解决方案,具有免费.高效.扩展性强且资源消耗低等优良特性.使用手工 ...
- mui项目实时更新
var wgtVer=null; function plusReady(){ // ...... // 获取本地应用资源版本号 plus.runtime.getProperty(plus.runtim ...
- PTA第三次作业
---恢复内容开始--- 题目 7-1 计算职工工资 1.设计思路 (1)第一步:观察题意了解各个参数与所需函数在题目中的意义: 第二步:设计算法编写函数,让函数的功能实现题目中所需的功能: 第三步: ...
- [Swift]LeetCode81. 搜索旋转排序数组 II | Search in Rotated Sorted Array II
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e. ...
- [Swift]LeetCode274.H指数 | H-Index
Given an array of citations (each citation is a non-negative integer) of a researcher, write a funct ...
- [Swift]LeetCode605. 种花问题 | Can Place Flowers
Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, ...