-
Notifications
You must be signed in to change notification settings - Fork 309
Inspect a new tab
Andrea Cardaci edited this page Jul 22, 2018
·
7 revisions
Create a new tab, attach to it, load an URL wait for the load event and close it.
const CDP = require('chrome-remote-interface');
async function navigateInANewTab(url, host, port) {
const target = await CDP.New({host, port});
const {Page} = await CDP({host, port, target});
await Page.enable();
await Page.navigate({url});
await Page.loadEventFired();
await CDP.Close({id: target.id});
}
navigateInANewTab('https://github.com'
/* optional host */
/* optional port */);