YusukeIwaki / capybara-playwright-driver

Playwright driver for Capybara
MIT License
154 stars 13 forks source link

How do I set the screen size and screenshot size? #61

Closed mhenrixon closed 1 year ago

mhenrixon commented 1 year ago

Thanks for a phenomenal open-source project. I haven't been able to figure out how to control the screen size and the screenshot size.

I'd love it a little bigger, and it doesn't look like the default settings for capybara or system tests does anything.

YusukeIwaki commented 1 year ago

@mhenrixon Could you provide an example code?

I think resize_window_to would change the viewport size.

mhenrixon commented 1 year ago

How do i set resize_window_to?

YusukeIwaki commented 1 year ago

Please refer this: https://stackoverflow.com/questions/18390071/change-default-capybara-browser-window-size resize_window_to is common to Selenium Driver and also available on capybara-playwright-driver.

mhenrixon commented 1 year ago
Capybara.page.current_window.resize_to(2048, 1536)

Does the trick!