这是转到特定网站的简单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/')
错误消失。由于我的数据库包含未经SSL认证的网站,是否有任何方法只能浏览它们?这是我的尝试,但是也失败了:
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')
每次运行代码时触发的错误如下所示:
errorhandler.py“,第242行,在check_response中引发exception_class(消息,屏幕,堆栈跟踪)selenium.common.exceptions.InvalidArgumentException:消息:无效参数(会话信息:chrome = 79.0.3945.130)
get()
上,www.google.com
不是有效的网址。为了不安全,您可以使用http
而不是https
driver.get('http://www.google.com')