I am trying to login on the site using puppeteer and then some other stuff after I am logged in. Connection to site was successful, but I have problem with function focus(). It needs a selector as an parameter, but after inserting one, it show an error (selector is good, because I ran document.querySelector("input.login-field") in console of the site and returned this: <input class="login-field" type="text" inputmode="email" autocapitalize="none" name="m" placeholder="Email or username" value="">
). What's the problem?
Here's my code:
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({headless: false, slowMo: 25});
const page = await browser.newPage();
await page.goto("site");
await page.focus("input.login-field");
await page.keyboard.type("information");
await browser.close();
})();
Aucun commentaire:
Enregistrer un commentaire