1.ChromeDriver版本和Chrome版本不兼容时,易出现运行报错(更换对应匹配的版本)
2.页面加载缓慢,出现执行一半就卡死情况(添加页面加载等待sleep)
在Chrome下运行脚本,报错(版本不兼容): selenium.common.exceptions.WebDriverException: Message: session not created exception from disconnected: received Inspector.detached event(Session info: chrome=52.0.2743.6)(Driver info: chromedriver=2.16.333243 (0bfa1d3575fc1044244f21ddb82bf870944ef961),platform=Windows NT 6.1 SP1 x86_64)
脚本:【
# coding=utf-8
from selenium import webdriver
from time import sleep
driver =webdriver.Chrome()
driver.get("https://m.edmbuy.com/")
driver.find_element_by_xpath("/html/body/footer/a[4]").click()
sleep(3)
driver.find_element_by_xpath("//*[@class