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

Already on GitHub? Sign in to your account

Page screenshot resizes the browser using hardcoded dimensions #388

Closed
almog opened this Issue Sep 9, 2012 · 1 comment

Comments

Projects
None yet
2 participants

almog commented Sep 9, 2012

I'm using `page.driver.resize_window(2560, 1440)in some of my Cucumber scenarios. For some time I've noticed thatpage.driver.render``does not take that size into account.
Today I've stumbled into this again, this time I've noticed that it can receive an optional``{width: 2560, height: 1440}`` hash.
If this hash isn't psased however, not only that it doesn't use the current browser size, it actually resizes the browser to an hard-coded size.

Collaborator

mhoran commented Sep 9, 2012

@almog, it looks like there are a few things in play here. First off, Capybara::WebKit::Driver#render does set a default if width and height are not provided (1000px and 10px, respectively). The Render command inside webkit_server then sets the viewport size to the width and height provided by the driver (either the user-specified width and height, or the defaults.) The the WebPage::render method sets the viewport size to contentsSize, which is a property of the mainFrame. After rendering the screenshot, the viewport size is set back to its original value. So, it seems possible that the captured screenshot would never actually correspond to the provided width and height, depending on the content size.

The resizing of the viewport to the defaults is something we can fix. I'm not sure what to do in the case of contentsSize differing from the viewport size, since this seems to be intentional functionality.

@mhoran mhoran closed this in eb7104c Jan 13, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment