Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

puppeteer open browser authentication facebook

if (!Object.keys(cookies).length) {await page.goto("https://www.facebook.com/login", { waitUntil: "networkidle2" });await page.type("#email", config.username, { delay: 30 })await page.type("#pass", config.password, { delay: 30 })await page.click("#loginbutton");await page.waitForNavigation({ waitUntil: "networkidle0" });await page.waitFor(15000);try {await page.waitFor('[data-click="profile_icon"]');} catch (err) {console.log("failed to login");process.exit(0);}let currentCookies = await page.cookies();fs.writeFileSync('./cookies.json', JSON.stringify(currentCookies));} else{//User Already Logged In}
Source by levelup.gitconnected.com #
 
PREVIOUS NEXT
Tagged: #puppeteer #open #browser #authentication #facebook
ADD COMMENT
Topic
Name
2+7 =