小编Leo*_*o S的帖子

如何使用 playwright 登录 google 帐户?

我有以下源代码并在 headful 模式下运行它。我可以输入电子邮件地址。但是,之后会出现消息“无法让您登录。为了保护您的利益,您无法从此设备登录。请稍后重试,或从其他设备登录。”。

我需要设置额外的标头或其他内容吗?

这是我的源代码。

const playwright = require('playwright');
const cookiePath = '/home/ubuntu/.config/chromium/Default';
browser['chromium'] = await playwright['chromium'].launchPersistentContext(cookiePath,{
  headless: false,
  args: [
      `--disable-extensions-except=${pathToExtension}`,
      `--load-extension=${pathToExtension}`,
      ],
});
const page = await browser['chromium'].newPage();
const login_url = "https://accounts.google.com/signin/v2/identifier?hl=ja&flowName=GlifWebSignIn&flowEntry=ServiceLogin"; 
await page.goto(login_url);
await page.fill('#identifierId',userinfo['id']);
await page.click("#identifierNext");
await page.fill('[name=password]',userinfo['password']);
await page.click("#passwordNext");
Run Code Online (Sandbox Code Playgroud)

node.js playwright

8
推荐指数
1
解决办法
1万
查看次数

无头铬定位

有人知道如何在无头Chrome中设置地理位置吗?

我一直在研究如何设置,并找到了以下文章。但是,我不知道该如何设置。

https://developers.google.com/web/updates/2016/04/geolocation-on-secure-contexts-only

我的环境在这里。

Ubuntu 18.04 Chrome:67.0.3396.99

谢谢。

google-chrome headless geolocation

5
推荐指数
1
解决办法
233
查看次数