使用Python+selenium+Chrome 报错:
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 78
说明,这个chrom驱动支持78版本
进入驱动网址:http://npm.taobao.org/mirrors/chromedriver/,下载对应版本的谷歌驱动。
使用百度最简单的案例,
试一下是否能成
#encoding:utf-8
from selenium import webdriver
import time
driver=webdriver.Chrome(executable_path="./../lib/chromedriver.exe")
driver.get("http://www.baidu.com")
time.sleep(3)
print driver.title
assert "百度一下" in driver.title
elem=driver.find_element_by_id("kw")
elem.send_keys("selenium")
driver.find_element_by_id("su").click()
time.sleep(3)
print driver.title
assert "selenium" in driver.title
driver.close()
比较好的教程:https://blog.csdn.net/weixin_36279318/article/details/79475388
被拦截了,
2020年9月之后应该就很难爬了