在 Docker 容器中登录 Google Chrome 配置文件

在 Docker 容器中登录 Google Chrome 配置文件

我在用硒独立铬在 docker 容器上运行 selenium 自动化脚本的图像。我尝试自动化的所有网站都有使用 google 登录的选项。但为了做到这一点,我需要登录到 selenium 创建的 chrome 会话。最强行的方法是输入我的 google 帐户的电子邮件地址和密码并禁用 2FA。但我不想这么做。

我知道我们可以在初始化 webdriver 时提供 chrome 数据目录的路径作为选项: directory_profile = "C:\\User\\yourUserOfYourPc\\AppData\\Local\\\Google\\Chrome\\User Data\\Default" #if you have only one profile, you can use this setting, however it's not, type it until "User Data"

我可以将这些凭据添加到使用 google cloud/google api 的 docker 镜像创建的 linux 系统中吗?

基本上,我需要某种方式在 docker 容器中由 selenium webdriver 创建的 chrome 会话中登录到我的 google 帐户。

感谢您的时间...

相关内容