-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.dev.js
36 lines (30 loc) · 979 Bytes
/
test.dev.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const puppeteer = require('puppeteer');
// const InterceptionUtils = require('automation-extra-interception-proxy');
const InterceptionUtils = require('./');
// do everything async
(async () => {
// launch some browser
const browser = await puppeteer.launch({
headless: false,
devtools: true,
args: [
'--incognito',
'--start-in-incognito',
],
});
// get some page
const [page] = await browser.pages();
// attach interception commands
const interceptions = await InterceptionUtils.wrapPage(page, {
requestMode: 'managed',
// requestMode: 'native',
// enableLegacyCookieHandling: true,
});
console.log({ interceptions })
try {
await page.goto('http://localhost:3000/cors.html', { timeout: 3000 });
} catch (err) {
await page.goto('https://www.npmjs.com/package/automation-extra-interception-proxy');
}
console.log('Go!');
})()