美文网首页
python3+selenium+google出现error:s

python3+selenium+google出现error:s

作者: 菜菜笛 | 来源:发表于2021-03-08 21:39 被阅读0次

记录于2021-03-08,OS为阿里云轻量应用服务器CentOS 7.3

错误信息截图

可以通过以下三种方案的任一解决方案解决此问题:
chrome_options.add_argument('--no-sandbox')

sudo mount -t tmpfs -o rw,nosuid,nodev,noexec,relatime,size=512M tmpfs /dev/shm

chrome_options.add_argument('--disable-dev-shm-usage')此方案可能会减慢执行速度,但就是它解决了我的问题

正常运行chrome_options:

options = webdriver.ChromeOptions()
options.add_argument('--headless')
options.add_argument('--disable-gpu')
options.add_argument('--no-sandbox')
driver = webdriver.Chrome(executable_path="/home/admin/test/chromedriver", chrome_options=options)

参考:http://www.cocoachina.com/articles/64022

相关文章

网友评论

      本文标题:python3+selenium+google出现error:s

      本文链接:https://www.haomeiwen.com/subject/kcymqltx.html