From 34517075406d18f7e7bf2110636b07f758022f48 Mon Sep 17 00:00:00 2001 From: JxxIT <110342008+JxxIT@users.noreply.github.com> Date: Tue, 14 Jan 2025 14:23:18 +0100 Subject: [PATCH 1/2] Update README.md to remove deprecated page.target --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 7798100..3e172d6 100644 --- a/README.md +++ b/README.md @@ -39,9 +39,9 @@ To modify intercepted requests: import { RequestInterceptionManager } from 'puppeteer-intercept-and-modify-requests' // assuming 'page' is your Puppeteer page object -const client = await page.target().createCDPSession() +const client = await page.createCDPSession() // note: if you want to intercept requests on ALL tabs, instead use: -// const client = await browser.target().createCDPSession() +// const client = await browser.createCDPSession() const interceptManager = new RequestInterceptionManager(client) @@ -118,7 +118,7 @@ async function main() { const browser = await puppeteer.launch() const page = await browser.newPage() - const client = await page.target().createCDPSession() + const client = await page.createCDPSession() const requestInterceptionManager = new RequestInterceptionManager(client) const interceptionConfig: Interception = { @@ -185,7 +185,7 @@ async function main() { const browser = await puppeteer.launch() const page = await browser.newPage() - const client = await page.target().createCDPSession() + const client = await page.createCDPSession() const requestInterceptionManager = new RequestInterceptionManager(client) const interceptionConfig: Interception = { @@ -223,7 +223,7 @@ async function main() { const browser = await puppeteer.launch() const page = await browser.newPage() - const client = await page.target().createCDPSession() + const client = await page.createCDPSession() const requestInterceptionManager = new RequestInterceptionManager(client, { onError: (error) => { console.error('Request interception error:', error) @@ -265,7 +265,7 @@ async function main() { const browser = await puppeteer.launch() const page = await browser.newPage() - const client = await page.target().createCDPSession() + const client = await page.createCDPSession() const requestInterceptionManager = new RequestInterceptionManager(client) const interceptionConfig: Interception = { @@ -294,7 +294,7 @@ When creating the `RequestInterceptionManager` instance, you can pass in the `cl ```ts // intercept requests on ALL tabs, instead use: -const client = await browser.target().createCDPSession() +const client = await browser.createCDPSession() const interceptManager = new RequestInterceptionManager(client) // ... @@ -315,7 +315,7 @@ async function main() { const browser = await puppeteer.launch() const page = await browser.newPage() - const client = await page.target().createCDPSession() + const client = await page.createCDPSession() const requestInterceptionManager = new RequestInterceptionManager(client) const interceptionConfig: Interception = { From 18da61cf3602c0a4d8ae6929cea240e420fe7542 Mon Sep 17 00:00:00 2001 From: JxxIT <110342008+JxxIT@users.noreply.github.com> Date: Tue, 14 Jan 2025 14:52:19 +0100 Subject: [PATCH 2/2] Revert target function removal with browser --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3e172d6..dd1ca5c 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ import { RequestInterceptionManager } from 'puppeteer-intercept-and-modify-reque // assuming 'page' is your Puppeteer page object const client = await page.createCDPSession() // note: if you want to intercept requests on ALL tabs, instead use: -// const client = await browser.createCDPSession() +// const client = await browser.target().createCDPSession() const interceptManager = new RequestInterceptionManager(client) @@ -294,7 +294,7 @@ When creating the `RequestInterceptionManager` instance, you can pass in the `cl ```ts // intercept requests on ALL tabs, instead use: -const client = await browser.createCDPSession() +const client = await browser.target().createCDPSession() const interceptManager = new RequestInterceptionManager(client) // ...