今天遇到个小问题: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
实践出真知~