Opening a browser in fullscreen mode using watir-webdriver

Chandiran picture Chandiran · Jul 14, 2011 · Viewed 16.3k times · Source

I know this is a very silly question. Yet, am not able to find how to make the browser open in fullscreen mode using watir webdriver. i tried using maximize() but in vain. This is how the code looks like:

require "rubygems"
require "watir-webdriver"
ff = Watir::Browser.new(:firefox)
ff.goto("http://google.com")
ff.maximize()

getting the error "undefined method maximize"

Answer

Gonzalo picture Gonzalo · Sep 13, 2012

Right now, it's possible to maximize the browser doing:

require "rubygems"
require "watir-webdriver"
browser = Watir::Browser.new(:firefox)
browser.goto("http://google.com")    
browser.driver.manage.window.maximize

Actually is going down to Selenium Driver to handle it, and AFAIK it works fine in Firefox and Chrome.