selenium 安装Chrome浏览器驱动

 

下载与当前Chrome对应的chromedriver.exe

浏览器查看版本号,对应下载驱动 

1、chromedriver驱动包下载地址:http://chromedriver.storage.googleapis.com/index.html

2、将下载的驱动 chromedriver  放到 PYTHON 安装目录 下(PS:非浏览器目录下哈)

 3、启动浏览器  driver = webdriver.Chrome()

不想经常手动下载驱动  或是 其它浏览器  https://www.cnblogs.com/zibinchen/p/14310637.html

超攒的博客

 python selenium自动化之chrome与chromedriver版本兼容问题

https://www.cnblogs.com/new-june/p/14249974.html

 

报错:

File "C:\Users\HUAWEI\AppData\Roaming\Python\Python38\site-packages\selenium\webdriver\common\service.py", line 81, in start
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

 解决方法:

把下载好的驱动 chromedriver 放到PYTHON 安装目录 下(非浏览器目录下) ,正常了

 

明细可以参考以下大神网址

https://www.cnblogs.com/LLSHPower/p/12160506.html

http://element-ui.cn/news/show-17251.aspx

 

 

from selenium import webdriver
from selenium.webdriver.common.by import By
import time

from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.firefox import GeckoDriverManager
from webdriver_manager.microsoft import EdgeChromiumDriverManager



browserName = 'chrome'
if browserName == 'chrome':
    driver = webdriver.Chrome(ChromeDriverManager.install())

elif browserName == 'firefox':
    driver = webdriver.Firefox(executable_path=GeckoDriverManager().install())

elif browserName == 'safari':
    driver= webdriver.safari()
else :
    driver = webdriver.Edge(EdgeChromiumDriverManager().install())'''

  

posted @ 2020-03-06 15:07  yongqi-911  阅读(8293)  评论(0编辑  收藏  举报