linux环境安装chrome和chromdriver

linux安装chrome和chromedriver

安装chrome浏览器

yum install https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
yum install mesa-libOSMesa-devel gnu-free-sans-fonts wqy-zenhei-fonts
wget https://cdn.npm.taobao.org/dist/chromedriver/83.0.4103.14/chromedriver_linux64.zip # 要根据下载chrome版本找对应版本的chromedriver下载

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

linux运行chromedriver配置项

from selenium.webdriver.chrome.options import Options
options = Options()
# linux环境下启动,必须加上如下参数
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--headless')
browser = webdriver.Chrome(options=options)

chromedriver下载链接:http://npm.taobao.org/mirrors/chromedriver/

你可能感兴趣的:(linux环境安装chrome和chromdriver)