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)