标签:shm sel ring enable show get shu rpm options
pip3 install selenium
pip3 安装参考
yum install chromedriver.x86_64
cat << EOF > /etc/yum.repos.d/google-chrome.repo
[google-chrome]
name=google-chrome
baseurl=http://dl.google.com/linux/chrome/rpm/stable/x86_64
enabled=1
gpgcheck=1
gpgkey=https://dl.google.com/linux/linux_signing_key.pub
EOF
from selenium import webdriver
driver = webdriver.Chrome()
driver.get(‘http://www.baidu.com/‘)
print( driver.title )
driver.quit()
如果遇到错误"unknown error: DevToolsActivePort file doesn‘t exist " 使用以下配置
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument(‘--no-sandbox‘)
chrome_options.add_argument(‘--disable-dev-shm-usage‘)
chrome_options.add_argument(‘--headless‘)
driver = webdriver.Chrome(chrome_options=chrome_options)
driver.get(‘http://www.baidu.com/‘)
print( driver.title )
driver.quit()
标签:shm sel ring enable show get shu rpm options
原文地址:https://www.cnblogs.com/du-jun/p/10577545.html