今天遇到個小問題:selenium 啓動 chrome crash,報錯:DevToolsActivePort file doesn't exist。
在option中添加一下幾行:
option = webdriver.ChromeOptions() option.add_argument('--headless') option.add_argument('--no-sandbox') # fix:DevToolsActivePort file doesn't exist option.add_argument('--disable-gpu') # fix:DevToolsActivePort file doesn't exist option.add_argument('--disable-dev-shm-usage') # fix:DevToolsActivePort file doesn't exist option.add_argument('--remote-debugging-port=9222') # fix:DevToolsActivePort file doesn't