Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After setRequestInterception(true), repeatedly accessing a web page, the response returned is null #2976

Closed
djytwy opened this issue Jul 29, 2018 · 2 comments

Comments

@djytwy
Copy link

djytwy commented Jul 29, 2018

my environment:

  • Puppeteer version:1.6.1
  • Platform / OS version:mac OS 10.13.4
  • Node.js version:v8.9.4
  • Chromium-version:69.0.3494.0 (x64)

The bug can be reproduced by the following code

const puppeteer = require('puppeteer');

(async () => {
    const browser = await puppeteer.launch({
        headless: false,
        args: ['--no-sandbox', '--disable-setuid-sandbox']
    });

    let rep = "";
    const page = await browser.newPage();
    await page.setRequestInterception(true);

    page.on('request',interceptedRequest => {
        if (interceptedRequest.url().endsWith('.png') || interceptedRequest.url().endsWith('.jpg'))
            interceptedRequest.abort();
        else
            interceptedRequest.continue();
    })

    rep = await page.goto('https://www.github.com');
    await page.waitFor(2000);
    console.log("this is response :" + rep);
    await page.close();

    const page2 = await browser.newPage();
    await page2.setRequestInterception(true);

    page2.on('request',interceptedRequest => {
        if (interceptedRequest.url().endsWith('.png') || interceptedRequest.url().endsWith('.jpg'))
            interceptedRequest.abort();
        else
            interceptedRequest.continue();
    })

    rep = await page2.goto('https://www.github.com');
    await page2.waitFor(2000);
    console.log("this is response :" + rep);
    await page2.close();

    browser.close();
})()

log:this is response :[object Object]
log:this is response :null
@djytwy
Copy link
Author

djytwy commented Jul 29, 2018

this bug must be from Chromium the code run in Chromium-version:69.0.3425.0 (x64)
result:

log:this is response :[object Object]
log:this is response :[object Object]

@aslushnikov
Copy link
Contributor

Dupe of #2970.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@aslushnikov @djytwy and others