在使用 chromedrive + selenium 儲存 screen shot 時,會遇到畫面太大,無法儲存 screen shot 並且顯示錯誤訊息:
timeout: Timed out receiving message from renderer: 10.000
解法,透過減少畫面的大小:
chrome_options.add_argument(“–window-size=1024,1024”)
或先註解這一行,執行一次程式,然後移除註解後,再重新執行一次,神奇的就可以了,呵呵。
chrome_options.add_argument(‘–headless’)
說明:上面這行的效果是讓 chrome 在背景執行,滿神奇的。
其他有趣的參數:
options.add_argument("start-maximized");
#https://stackoverflow.com/a/26283818/1689770
options.add_argument("enable-automation");
#https://stackoverflow.com/a/43840128/1689770
options.add_argument("--headless");
#only if you are ACTUALLY running headless
options.add_argument("--no-sandbox");
#https://stackoverflow.com/a/50725918/1689770
options.add_argument("--disable-infobars");
#https://stackoverflow.com/a/43840128/1689770
options.add_argument("--disable-dev-shm-usage");
#https://stackoverflow.com/a/50725918/1689770
options.add_argument("--disable-browser-side-navigation");
#https://stackoverflow.com/a/49123152/1689770
options.add_argument("--disable-gpu");
#https://stackoverflow.com/questions/51959986/how-to-solve-selenium-chromedriver-timed-out-receiving-message-from-renderer-exc
相關文章:
Timed out receiving message from renderer: 10.000 while capturing screenshot using chromedriver and chrome through Jenkins on Windows
https://stackoverflow.com/questions/55364056/timed-out-receiving-message-from-renderer-10-000-while-capturing-screenshot-usi