microlinkhq / browserless

The headless Chrome/Chromium driver on top of Puppeteer.
https://browserless.js.org
MIT License
1.61k stars 79 forks source link

Devices with isMobile cause empty screenshots #536

Closed TriPSs closed 9 months ago

TriPSs commented 10 months ago

Prerequisites

Subject of the issue

When creating a screenshot with for example device Microsoft Lumia 950 landscape (or any other device that has isMobile=true causes the screenshot to be become empty

Steps to reproduce

Note: You can reproduce the code using interactive Node.js shell by Runkit.

Tell us how to reproduce this issue.

await browser.goto(page, {
        url: 'https://google.com',
        device: 'Microsoft Lumia 950 landscape',
})

When logging the above code it already returns error: Error: net::ERR_ABORTED at https://google.com, I think this is because a device with isMobile causes the page to reload and the timeout to hit.

Expected behaviour

It to run correctly, not throwing an error.

Actual behaviour

An error is being thrown.

Kikobeats commented 9 months ago

Thanks a lot. It should be fixed in the last version

Can you verify at your end? https://github.com/microlinkhq/browserless/releases/tag/v10.2.1 🙂

TriPSs commented 9 months ago

It is indeed working now, thanks!

Also I found a typo in the code: https://github.com/microlinkhq/browserless/blob/0b578051040d09db17d9f03d49dc713ab70dc886/packages/screenshot/src/index.js#L22 I think naturalWeight should be naturalWidth?

Kikobeats commented 9 months ago

@TriPSs good catch; can you make a PR? happy to see new contributors 🙂

TriPSs commented 9 months ago

Ofc (#541)