谷歌浏览器实现Python+selenium自动化测试
出现问题:
selenium.common.exceptions.WebDriverException: Message: ‘chromedriver_win32’ executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home
出现原因:
1、缺少与浏览器版本匹配的webdriver
使用:chrome://version/ 查看浏览器版本
Google Chrome 91.0.4472.106 (正式版本) (64 位) (cohort: Stable)
解决方案:
1、选择合适版本的驱动下载, 如果没有完全匹配的就选最相似匹配的版本下载。
下载地址:
http://chromedriver.storage.googleapis.com/index.html
2、解压下载的驱动放到指定目录,代码调用时指定该目录即可。
browser = webdriver.Chrome(r"D:\工作文件\cms源码\python\chromedriver_win32\chromedriver.exe")