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

When the target element width is zero, elementHandle.screenshot does not work. #2672

Closed
boiawang opened this issue Jun 4, 2018 · 8 comments
Labels
chromium Issues with Puppeteer-Chromium

Comments

@boiawang
Copy link

boiawang commented Jun 4, 2018

Tell us about your environment:

  • Puppeteer version: v1.4.0
  • Platform / OS version: linux
  • Node.js version: v8.11.0

What steps will reproduce the problem?

Please include code that reproduces the issue.

const puppeteer = require('puppeteer');

const browser = await puppeteer.launch({
  args: ['--no-sandbox', '--disable-setuid-sandbox']
});
const page = await browser.newPage();
const SCREENSHOT_FILE = 'screenshot.png';

await page.goto('xxx.com');
await page.waitForSelector('div'); 
const areaContainer = await page.$('div');

await areaContainer.screenshot({
  path: SCREENSHOT_FILE
});
console.log('screenshot end');   // cannot execute to this line
await browser.close();

What is the expected result?

console.log('screenshot end') cannot execute when div has no width and height.

What happens instead?

I hope it shouldn't be blocked, Or throw a error?

@aslushnikov
Copy link
Contributor

@boiawang I can't repro this with pptr v1.5.0 and with the following script:

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  await page.setContent('<div style="width: 0; height: 0"></div>');
  const div = await page.$('div');

  await div.screenshot({
    path: 'screenshot.png'
  });
  console.log('screenshot end');   // cannot execute to this line
  await browser.close();
})();

We might've fixed this in puppeteer v1.5.0; speculatively closing this.
If you still experience this on pptr v1.5.0, feel free to write here or re-file another one with a good repro.

@pkra
Copy link

pkra commented Aug 16, 2018

@aslushnikov The minimal example you had posted hangs for me using v1.7.0. Does it (still) work for you?

@pkra
Copy link

pkra commented Aug 21, 2018

@aslushnikov for more background, I see this on Linux (Ubuntu 18.04), node v10.9.0, puppeteer v1.7.0, chromium r579032.

@aslushnikov
Copy link
Contributor

@pkra: works nicely for me. I think we even have a test that makes sure this scenario is functioning.

@pkra
Copy link

pkra commented Sep 7, 2018

@aslushnikov thanks for the response. This still consistently hangs for me on Linux (Ubuntu 18.04), node v10.9.0, chromium r588429.

Would you have ay advice on how to dig deeper into this?

@aslushnikov
Copy link
Contributor

@pkra hmm I didn't find a test for this; I've added one - let's see how it performs on our trybots.

@aslushnikov
Copy link
Contributor

Ah, linux is busted indeed.

@aslushnikov aslushnikov reopened this Sep 7, 2018
@pkra
Copy link

pkra commented Sep 7, 2018

Thanks so much for looking into it, @aslushnikov!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chromium Issues with Puppeteer-Chromium
Projects
None yet
Development

No branches or pull requests

3 participants