首页 > 解决方案 > 使用 Chrome --headless + cookies/oauth token 截取页面截图

问题描述

我发现,可以轻松地截取页面截图 - https://superuser.com/questions/1410641/how-to-take-screenshots-of-a-list-of-urls - 通过调用:

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --headless --disable-gpu --enable-logging --screenshot="C:\path\to\screenshot.png" http://example.com/

但是它正在启动新的 Chrome 进程,这导致我能够截取简单页面的屏幕截图,但是页面和身份验证(如 Oauth2)呢?我可以以某种方式使用 chrome,使用已经存在的浏览器“会话”,我登录到感兴趣的页面,我将要截取屏幕截图或传递 oauth2 令牌甚至 cookie,不知何故?

标签: google-chromegoogle-chrome-devtoolsheadlessgoogle-chrome-headless

解决方案


推荐阅读