I’m using puppeteer to automate access to a specific newspaper. The problem is that to enter the email and password it is necessary to click on the sign in button and wait for a popup to open.
However, when waiting for a selector that is in the login popup, the following error is reported: UnhandledPromiseRejectionWarning: TimeoutError: Waiting for selector input[fieldloginemail]
failed: Waiting failed: 30000ms exceeded.
Could anyone help me in this case? I’m using puppeteer 19.8.5.
My code:
const puppeteer = require("puppeteer");
puppeteer
.launch({ headless: false, defaultViewport: null })
.then(async (browser) => {
const page = await browser.newPage();
await page.goto("https://pressreader.df.cl/diario-financiero");
await page.waitForSelector(".btn-login, .toolbar-button-signin", {
visible: true,
});
await page.click(".btn-login, .toolbar-button-signin");
const emailSelector = 'input[fieldloginemail]'
const passwordSelector = 'input[fieldloginpassword]'
await page.waitForSelector(emailSelector)
await page.waitForSelector(passwordSelector)
await page.type(emailSelector, '[email protected]')
await page.type(passwordSelector, 'myPassword')
await page.click('button[actionlogin]')
await browser.close();
});