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

Page#setViewport required options #3517

Closed
SheetJSDev opened this issue Nov 8, 2018 · 2 comments · Fixed by #3561
Closed

Page#setViewport required options #3517

SheetJSDev opened this issue Nov 8, 2018 · 2 comments · Fixed by #3561

Comments

@SheetJSDev
Copy link

	await page.setViewport({width: WIDTH});

with no height, puppeteer rejects with the error message:

Protocol error (Emulation.setDeviceMetricsOverride): Invalid parameters width: integer value expected

However, the documentation https://pptr.dev/#?product=Puppeteer&version=v1.10.0&show=api-pagesetviewportviewport does not indicate that both height and width are required.

IMHO setting just the width should change the width while leaving the height untouched (default being the current width/height). However, if the current behavior is desirable, the docs should be updated to reflect that. Other functions like page#setCookie explicitly mark fields as required in bold, and the same thing should probably happen here.

@aslushnikov
Copy link
Contributor

However, if the current behavior is desirable, the docs should be updated to reflect that.

I'd appreciate a PR.

@Nazanin1369
Copy link
Contributor

I'd love to take this

Nazanin1369 added a commit to Nazanin1369/puppeteer that referenced this issue Nov 17, 2018
Add required to height and width properties in setViewport function
aslushnikov pushed a commit that referenced this issue Nov 19, 2018
Add required to height and width properties in setViewport function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants