使用selenium.webdriver时报错:
selenium.common.exceptions.WebDriverException: Message: ‘chromedriver’ executable needs to be in PATH.
或者:
找不到chrome binary
或者 显示版本不对
解决办法:
确定driver版本正确的情况下,将chromedriver.exe放在chrome.exe同一文件夹下。
并且在代码中指定driver路径:
chrome_driver = r'E:\Program Files (x86)\Chrome\Application\chromedriver.exe' #chromedriver.exe要放在chrome.exe同一文件夹中
diver = webdriver.Chrome(executable_path=chrome_driver)
#访问url
def open(self,url):
self.diver.get(url)