Skip to content

Browser extension that outputs a cookie JSON file that can be imported by Selenium

Notifications You must be signed in to change notification settings

dayatnhbtc/export-cookie-for-selenium

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

icon Export cookie JSON file for Puppeteer

Browser extension that outputs a cookie JSON file that can be imported by Puppeteer or cheerio-httpcli.

Install

Usage

By clicking on the extension icon, you can save the cookie information stored on the currently open page as a JSON file.

image1 image2

The saved JSON file can be used as follows.

Puppeteer

const puppeteer = require('puppeteer');
  .
  .
  .
const browser = await puppeteer.launch({ headless: true });
const page = await browser.newPage();
const cookies = JSON.parse(fs.readFileSync(<Exported cookie JSON file>, 'utf-8'));
for (const cookie of cookies) {
  await page.setCookie(cookie);
}
await page.goto(...);

cheerio-httpcli

const client = require('cheerio-httpcli');
  .
  .
  .
const cookies = JSON.parse(fs.readFileSync(<Exported cookie JSON file>, 'utf-8'));
client.importCookies(cookies);
client.fetch(...);

License

MIT license

© 2020 ktty1220

About

Browser extension that outputs a cookie JSON file that can be imported by Selenium

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 82.1%
  • HTML 9.3%
  • CSS 8.6%