首页 > Web开发 > 详细

Centos7 安装selenium webdriver环境

时间:2020-05-19 18:49:07      阅读:199      评论:0      收藏:0      [点我收藏+]

最重要的是:webdriver及chrome-browser版本一致,否则启动失败

1. 安装selenium

pip3 install selenium

2. 安装chrome-browser

wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
 yum install ./google-chrome-stable_current_x86_64.rpm

安装完成后会显示当前版本。

我安装的版本是81.0.4044.138

3. 安装chromedriver(千万与chrome-browser版本对应)

在 http://chromedriver.storage.googleapis.com/这个页面找对应版本的下载地址

wget http://chromedriver.storage.googleapis.com/81.0.4044.138/chromedriver_linux64.zip

解压unzip chromedriver_linux64.zip

mv chromedriver /usr/bin即可

4. 测试

from selenium import webdriver
option = webdriver.ChromeOptions()
option.add_argument(‘--no-sandbox‘)
option.add_argument(‘--headless‘)
driver = webdriver.Chrome(chrome_options=option)

不报错即说明安装成功

Centos7 安装selenium webdriver环境

原文:https://www.cnblogs.com/shining5/p/12917998.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!