chrome-incognito-tools

1.0.1 • Public • Published

chrome-incognito-tools

Tools for chrome extensions to manipulate incognito sessions.

Tab

Wrapper to ease the use of tabs.

Open a tab, go to an URL and wait until tab is loaded

const Tab = require('chrome-incognito-tools/tab.js');

const myTab = await new Tab('myTabName');

await myTab.go('http://somewebsite.com');

Get a tab by name

let otherTab = await Tab.t('myTabName');
await otherTab.go('http://anotherwebsite.com');

Execute script in a tab:

Get all links and h1 tags:

let result = await myTab.script({ code:
	`({ 
		links: [...document.querySelectorAll('a')].map(a => a.href),
		h1: [...document.querySelectorAll('h1')].map(h => h.innerText)
	})`
});

Multiple sessions

API to manage cookie sessions inside chrome ingcognito mode, storing them locally or sync with the google account in use by chrome.

Motivation: multiple sessions without messing with the regular cookies.

Create new session

const MultipleSessions = require('./sessions.js');
const MS = new MultipleSessions();

await MS.addSession('mySession');

(work in progress: the goal is create an extension with this API)

Package Sidebar

Install

npm i chrome-incognito-tools

Weekly Downloads

2

Version

1.0.1

License

ISC

Unpacked Size

28.2 kB

Total Files

8

Last publish

Collaborators

  • brunoruarodesouza