如何使用 Playwright 或 Puppeteer 登录 google 帐户?
How to log in to google account using Playwright or Puppeteer?
有人可以帮助我吗,我需要使用 Puppeteer 或 Playwright 登录我的 google 帐户。有办法吗?
大多数情况 Google 会阻止无头登录 browsers/bots。尝试时您可能会看到一些类似的消息:
Couldn't sign you in
For your protection, you can't sign in from this device.
Try again later, or sign in from another device.
您需要提供凭据(像真实用户一样使用 page.click
和 page.type
)并提交form.* 如果它有头但你需要它在无头模式下工作,那么你可以使用 puppeteer-extra package with puppeteer-extra-plugin-stealth. Examples can be get from puppeteer-extra docs。 仅供参考: pptr-extra 使用较旧的 puppeteer 2.x 作为其基础,即使它可以与原始 puppeteer 库一起使用,您也可能会失去一些功能。
*如果需要处理使任务更加复杂的双因素身份验证。您可以确定 Google 已尽最大努力防止机器人登录。
+ 如果您的 puppeteer Chromium 实例被检测为无头浏览器,您可以在此处测试它:https://arh.antoinevastel.com/bots/areyouheadless
有人可以帮助我吗,我需要使用 Puppeteer 或 Playwright 登录我的 google 帐户。有办法吗?
大多数情况 Google 会阻止无头登录 browsers/bots。尝试时您可能会看到一些类似的消息:
Couldn't sign you in
For your protection, you can't sign in from this device. Try again later, or sign in from another device.
您需要提供凭据(像真实用户一样使用 page.click
和 page.type
)并提交form.* 如果它有头但你需要它在无头模式下工作,那么你可以使用 puppeteer-extra package with puppeteer-extra-plugin-stealth. Examples can be get from puppeteer-extra docs。 仅供参考: pptr-extra 使用较旧的 puppeteer 2.x 作为其基础,即使它可以与原始 puppeteer 库一起使用,您也可能会失去一些功能。
*如果需要处理使任务更加复杂的双因素身份验证。您可以确定 Google 已尽最大努力防止机器人登录。
+ 如果您的 puppeteer Chromium 实例被检测为无头浏览器,您可以在此处测试它:https://arh.antoinevastel.com/bots/areyouheadless