Skip to content

Commit 2bfa15a

Browse files
JMatejdaveomri
authored andcommitted
fix: addEventListener code example (apify#1808)
**Playwright** example did not work as expected (**I was able to** click Accept cookies button).
1 parent 82a3c62 commit 2bfa15a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sources/academy/webscraping/puppeteer_playwright/executing_scripts/injecting_code.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const page = await browser.newPage();
3535

3636
await page.addInitScript(() => {
3737
// Override the prototype
38-
Node.prototype.addEventListener = () => { /* do nothing */ };
38+
Node.prototype.addEventListener = null; /* do nothing */
3939
});
4040

4141
await page.goto('https://google.com');
@@ -55,7 +55,7 @@ const page = await browser.newPage();
5555

5656
await page.evaluateOnNewDocument(() => {
5757
// Override the prototype
58-
Node.prototype.addEventListener = null;
58+
Node.prototype.addEventListener = null; /* do nothing */
5959
});
6060

6161
await page.goto('https://google.com');

0 commit comments

Comments
 (0)