Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in DevOps and Agile by (19.7k points)

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 worked well for me.

I tried the following code.

page.execute_script('$(window).width(1200)')

Can anyone help with this?

1 Answer

0 votes
by (62.9k points)

You can use the resize_to(width, height) method which is an in-built method of selenium webdriver class.

For example, the below code snippet would resize the browser with 100px wide and 200px tall dimensions:

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

Browse Categories

...