错误:
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.34.522913 (36222509aa6e819815938cbf2709b4849735537c),platform=Linux 4.10.0-42-generic x86_64)
解决办法:
Start the Display before start the Chrome.
先执行一下两句安装命令(以ubuntu为例):
- pip install pyvirtualdisplay
- sudo apt-get install xvfb
然后添加如下代码:
- from pyvirtualdisplay import Display
- display = Display(visible=0, size=(800, 800))
- display.start()
- driver = webdriver.Chrome()