首页 > 编程知识 正文

产品质量问题解决方案,产品出现问题解决方案

时间:2023-05-03 11:14:30 阅读:222700 作者:1088

web自动化脚本操作https请求时,应该如何处理,针对不同浏览器,处理方式不同:

1.Chrome浏览器:需要添加ChromeOptions()的--ignore-certificate-errors选项为True

#_*_ coding:utf-8 _*_from selenium import webdriverif __name__ == '__main__': options=webdriver.ChromeOptions() options.add_argument('--ignore-certificate-errors') driver=webdriver.Chrome(chrome_options=options) driver.get(u'https://cacert.org/') driver.close()

2.FIRfOX浏览器:需要添加FirefoxProfile()的accept_untrusted_certs的选项为True

#_*_ coding:utf-8 _*_from selenium import webdriverif __name__ == '__main__': profile=webdriver.FirefoxProfile() profile.accept_untrusted_certs=True driver=webdriver.Firefox(firefox_profile=profile) driver.get(u'https://cacert.org/') driver.close()

3、IE浏览器:需要添加Desired Capabilities的acceptSslCerts选项为True

#_*_ coding:utf-8 _*_from selenium import webdriverif __name__ == '__main__': profile=webdriver.FirefoxProfile() profile.accept_untrusted_certs=True driver=webdriver.Firefox(firefox_profile=profile) driver.get(u'https://cacert.org/') driver.close()

 

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。