i'm trying to use puppeteer to log into a url, but it cannot find the inputs elements and the submit button, i believe the elements are generated dynamic by javascript, even tho i'm using the waitForSelector
it doesn't work, what i'm missing?
here's my code:
const puppeteer = require('puppeteer');
(async () => {
try {
const browser = await puppeteer.launch({
headless: false
});
const page = await browser.newPage();
await page.goto('http://contatoplus.com/#!login', { waitUntil: 'networkidle0' });
await page.waitForFunction("document.querySelector('#gwt-uid-3') && document.querySelector('#gwt-uid-3').clientHeight != 0");
// or wait until "visibility" not hidden
await page.waitForFunction("document.querySelector('#gwt-uid-3') && document.querySelector('#gwt-uid-3').style.visibility != 'hidden'");
const btnNext = await page.$('#gwt-uid-3');
await btnNext.keyboard.type('loginnn');
} catch (error) {
console.log(error);
}
})();
i followed this: https://stackoverflow.com/a/54103671/5309671