代码之家  ›  专栏  ›  技术社区  ›  Shivam Sahil

如何在使用Python的Selenium Webdriver中避免SSL认证错误?

  •  0
  • Shivam Sahil  · 技术社区  · 6 年前

    下面是一个简单的python代码,用于访问特定网站:

    import pandas as pd
    from selenium import webdriver
    from selenium.webdriver.common.keys import Keys
    from time import sleep
    from selenium.webdriver.common.by import By
    import time
    
    profile=webdriver.ChromeOptions()
    profile.add_argument('--ignore-certificate-errors')
    driver =webdriver.Chrome(r'C:\Utility_Tools\WebDriver\chromedriver.exe')
    driver.get('www.google.com')
    

    driver.get('https://www.google.com/')
    

    这是我的尝试,但也失败了:

    profile=webdriver.ChromeOptions()
    profile.add_argument('--ignore-certificate-errors')
    driver =webdriver.Chrome(r'C:\Utility_Tools\WebDriver\chromedriver.exe',options=profile)
    driver.get('www.google.com')
    

    错误处理程序.py“,第242行,在check\u响应中” 参数(会话信息:chrome=79.0.3945.130)

    1 回复  |  直到 6 年前
        1
  •  2
  •   Guy    6 年前

    问题出现了 get() , www.google.com 不是有效的url。因为不安全你可以用 http https

    driver.get('http://www.google.com')