解决webdriver中报错。
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /opt/google/chrome/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
from selenium.webdriver.chrome.options import Options
opt = Options()
opt.set_headless()
opt.add_argument('--no-sandbox')
opt.add_argument('--disable-dev-shm-usage')
opt.add_argument('--headless')
opt.add_argument('blink-settings=imagesEnabled=false')
opt.add_argument('--disable-gpu')
driver = webdriver.Chrome(chrome_options=opt) # 启动Chrome()