go directly to all the code:
const puppeteer = require("puppeteer");
; (async () => {
const browser = await puppeteer.launch({
headless: false, //
devtools: true, // F12
});
const page = await browser.newPage(); //
await page.waitFor(500); // 500ms
var cookie = {
name: "ccc",
value: "cccccccccccccccccc",
domain: "baidu.com",
path: "/",
expires: 7 * 24 * 60 * 60 * 1000
};
await page.setCookie(cookie); // cookie
await page.waitFor(500);
await page.goto("http://baidu.com/"); //
})();
then you can"t find a lot of cookie, Baidu that you set up in F12 of the browser, and the result is a bunch of rubbish to copy others, step by step, no change at all. Demo is also copied according to the official demo of google, and there is no demo about setting cookie in the github project.
is there any boss who has successfully set up cookie?