首页 > 其他分享 >Selenium基础:SSL证书错误处理 13

Selenium基础:SSL证书错误处理 13

时间:2023-07-10 16:11:32浏览次数:41  
标签:profile webdriver 13 证书 Selenium get driver 错误处理 options

1、chrome解决办法

在chromeoptions()中添加”--ignore-certificate-errors"为true的选项

#-*-coding: utf-8-*-
from selenium import webdriver
options = webdriver.ChromeOptions()
#添加忽视证书错误选项
options.add_argument ('--ignore-certificate-errors')
driver = webdriver.Chrome (chrome_options=options)
driver.get ('URL')

2、firefox解决办法

在FirefoxProfile()中添加“accept_untrusted_certs"为true的选项

profile = webdriver. FirefoxProfile()
# 添加接受不信任证书选项
profile.accept_untrusted_certs = True
driver = webdriver.Firefox (firefox_profile=profile)

3、IE解决办法

通过javascript语句,忽略不信任证书的提示继续访问,点击转到此网页(不推荐)即可

#-*-coding: utf-8-*-
from selenium import webdriver
driver = webdriver.Ie()
driver.get ( 'URL' )
#选择继续访问 URL
js = "javascript: document.getElementById (' overridelink' ) .click() ;"
driver.get (js)
driver.execute_script (js)

 

标签:profile,webdriver,13,证书,Selenium,get,driver,错误处理,options
From: https://www.cnblogs.com/ddupfan/p/17541457.html

相关文章

  • Anaconda环境下使用pip install selenium安装失败的解决办法
    背景:在Anaconda环境下执行pipinstallselenium,一直报timeout错误 解决方法:python-mpipinstallselenium 参考资料:https://blog.csdn.net/qq_45538469/article/details/113872262TRANSLATEwithxEnglishArabicHebrewPolishBulgarianHindiP......
  • Selenium基础:配置chrome浏览器 12
    1、屏蔽浏览器对selenium的检测”chrome正受到自动测试软件的控制。“解决方法:options=webdriver.ChromeOptions()options.add_experimental_option('excludeSwitches',['enable-automation'])driver=webdriver.Chrome(options=options)2、禁止图片和视频加载optio......
  • Selenium基础:其他设置 11
    1、限制页面加载时间设置页面加载限制时间:set_page_load_timeout(time)#-*-coding:utf-8-*-fromseleniumimportwebdriverfromselenium.common.exceptionsimportTimeoutExceptiondriver=webdriver.Chrome()#限制页面加载时间为30sdriver.set_page_load_timeout(30......
  • selenium优雅打开并关闭网页
    with上下文管理器在python中是这样介绍的所有实现了__enter____exit__dundermethod魔术方法的对象都可以用with接下来以Chrome为例查看底层def__enter__(self):returnselfdef__exit__(self,exc_type:typing.Optional[typing.Type[BaseExcept......
  • Go优雅的错误处理: 支持错误堆栈, 错误码, 错误链的工具库
    地址:https://github.com/morrisxyang/errors如果觉得有用欢迎Star和PR,有问题请直接提issueerrors简单的支持错误堆栈,错误码,错误链的工具库:支持携带堆栈,嵌套构造错误链支持携带错误码,方便接口返回支持自定义堆栈打印深度和错误链打印格式使用......
  • vue--day13--watch与computed的区别
    <!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"/><metaname="viewport"content="width=device-width,initial-scale=1.0"/><title>watch实现名字案例</title><scri......
  • 13. Q_ 如下代码中文本_Sausage_的颜色是_
    Q:如下代码中文本“Sausage”的颜色是?<ulclass="shopping-list"id="awesome"><li><span>Milk</span></li><liclass="favorite"id="must-buy"><spanclass="highlight">Saus......
  • 牛客练习赛113 D 小红的数组操作(hard version)
    题目要求求出最小的总代价使得平均数为整数,转换式子可得实际就是求出a,b使得(a*x-b*y+sum)%n==0且a*p+b*q要最小,平均值的为sum/n,因此对sum进行操作使其成为n的倍数即可(a*x-b*y+sum)%n==0=>((a*x+sum)%n-b*y%n)%n==0因为(a*x+sum)%n<n,b*y%n<n,因此要想二者差求余数为0一定为(......
  • t113-c-设备树-驱动调用篇(获取设备节点和属性)
    我们以pwm为例编写程序1.首先编写出入口函数//#include"linux/module.h"//#include"linux/fs.h"////#include"linux/stddef.h"//#include"linux/types.h"////#include"crypto/if_alg.h"#include"treecom.h"......
  • 锐龙5 7600搭配A620主板大战i5-13490F:整体便宜800元 游戏性能完全持平
    一、前言:搭配A620主板后锐龙57600能否战胜i5-13490F?作为当前售价最低的Zen4桌面处理器,锐龙57600在游戏性能上要远超同价位的i5-13400,而随着近期A620主板的大量上市,AMD平台的性价比又到了进一步提升。那么问题来了:如果搭配价格便宜的A620主板,锐龙57600到底会损失多少性能呢?......