How to set Browser Window size in Rspec (Selenium)

capybara, integration-testing, ruby-on-rails, selenium

Solution

You can use the `resize_to(width, height)` method that is part of the selenium webdriver.

For example, the following would make the browser 100px wide and 200px tall:

page.driver.browser.manage.window.resize_to(100,200)

Problem

I am working on Ruby On Rails integration test using capybara, Selenium. How to set testing Browser Window Height and Width? I searched, but nothing work well for me. I tried following code. ``` page.execute_script('$(window).width(1200)') ``` Can any one. please.

Original source