[WebDriver]innerWidth/innerHeight and outerWidth/outerHeight in WebDriver

x“: WindowProxy’s screenX attribute.

y“: WindowProxy’s screenY attribute.

width“: WindowProxy’s outerWidth attribute.

height“: WindowProxy’s outerHeight attribute.

https://www.w3.org/TR/webdriver/#resizing-and-positioning-windows

The Get Window Rect command returns the size and position on the screen of the operating system window corresponding to the current top-level browsing context.

https://www.w3.org/TR/webdriver/#get-window-rect

Interesting. The get window rect command returns outer stuff. The actual screenshot size is the inner one like:

@driver.execute_script 'return [window.innerWidth, window.innerHeight];'

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.