微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

centos7安装chrome和chromedriver以及selenium

How To Install Chrome On Centos 7
Download the google-chrome-stable

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

Lets install chrome Now.

yum localinstall google-chrome-stable_current_x86_64.rpm

Lets check if chrome is installed.

google-chrome --version
90.0.4430.24

Lets download chromdriver
[https://npm.taobao.org/mirrors/chromedriver/]
(https://npm.taobao.org/mirrors/chromedriver/)
and find your chrome version

wget https://npm.taobao.org/mirrors/chromedriver/90.0.4430.24/chromedriver_linux64.zip

Lets install chromdriver

 unzip chromedriver_linux64.zip 
 mv chromedriver /usr/bin
 chmod +x /usr/bin/chromedriver

and start your chromedriver

/usr/bin/chromedriver
ChromeDriver was started successfully.

Lets install Selenium first using pip.

pip install selenium
Collecting selenium
  Using cached https://files.pythonhosted.org/packages/80/d6/4294f0b4bce4de0abf13e17190289f9d0613b0a44e5dd6a7f5ca98459853/selenium-3.141.0-py2.py3-none-any.whl
Requirement already satisfied: urllib3 in /home/anaconda3/lib/python3.7/site-packages (from selenium) (1.24.2)
Installing collected packages: selenium
Successfully installed selenium-3.141.0

Lets try using the Selenium Now in Ipython. Import following packages in python and run with no head

from selenium import webdriver
chromeOptions = webdriver.ChromeOptions()
chromeOptions.add_argument("--headless")
chromeOptions.add_argument("--remote-debugging-port=9222")
chromeOptions.add_argument('--no-sandBox')
driver = webdriver.Chrome('/usr/bin/chromedriver',chrome_options=chromeOptions)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐