TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: How to pre-authorize runtime permissions for Chrome extensions

1 点作者 litbear20224 个月前
I have a simple `selenium` script that does not persist user data, that is, a new `--user-data-dir` is generated each time it is started.<p>It opens some tabs and uses the Fireshot API to take screenshots.<p>However, enable the Fireshot API requires granting the runtime permission `tabs` to the extension, and it can only be operated in a GUI environment. I hope to pre-authorize the runtime permissions required by the extension when running the script. All attempts below failed:<p>- Use `options.add_experimental_option(&#x27;prefs&#x27;, prefs)` to inject the `f&quot;extensions.settings.{EXT_ID}.runtime_granted_permissions&quot;` property into the `Preferences` file - Backup and restore the `userDataDir&#x2F;Preferences` and&#x2F;or `userDataDir&#x2F;Secure Preferences` - Use `initial_preferences` to load extension - Use the Chrome group policy, Also, it is scoped to the entire system or current user, and I just want to load the policy using command line parameters so that it works for the current example - Generate new user data dir, authorized runtime permission, backup once and restore every time the script running<p>Is there any other method besides the above? I can even accept modifying the opaque sqlite files under the User Data folder or Profile folder

暂无评论

暂无评论