目前环境为:uat./chromeDriver/linux/chromedriverTraceback (most recent call last): File "web_scraping_start.py", line 24, in <module> File "main.py", line 124, in main File "main.py", line 52, in scan_seeds File "utils/fn_get_web_driver.py", line 37, in fn_get_web_driver File "selenium/webdriver/chrome/webdriver.py", line 81, in __init__ File "selenium/webdriver/remote/webdriver.py", line 157, in __init__ File "selenium/webdriver/remote/webdriver.py", line 252, in start_session File "selenium/webdriver/remote/webdriver.py", line 321, in execute File "selenium/webdriver/remote/errorhandler.py", line 242, in check_responseselenium.common.exceptions.SessionNotCreatedException: Message: session not created: Chrome failed to start: exited normally. (session not created: DevToolsActivePort file doesn't exist) (The process started from chrome location /opt/google/chrome/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
解法:
加入options = webdriver.ChromeOptions()options.add_argument("--headless")options.add_argument("--disable-gpu")options.add_argument("--no-sandbox")options.add_argument("--disable-dev-shm-usage")
更新或是安装chrome的时候,记得将chrome权限,全开// shellsudo chmod 777 ./chrome// 用sudo执行sudo ./web_scraping_start uat