# MAXIMIZE the Browser Automaticaly

**URL:** <https://www.ruby-forum.com/t/maximize-the-browser-automaticaly/188974>\
**Category:** Ruby\
**Created:** [May 21, 2010, 10:35am UTC](https://www.ruby-forum.com/t/maximize-the-browser-automaticaly/188974 "2010-05-21T10:35:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sweetzubair](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7feea3/32.png) [@sweetzubair](https://www.ruby-forum.com/u/sweetzubair)\
**Post date:** [May 21, 2010, 10:35am UTC](https://www.ruby-forum.com/t/maximize-the-browser-automaticaly/188974/1 "2010-05-21T10:35:39Z")

</div>

I try Many thing but not find the best solution to maximize the window.  
i run the script every time window open in the normal size.

… Help me …

require ‘watir’  
include Watir

ie=Watir::IE.start(“[http://www.google.co.in](http://www.google.co.in)”)

#~ie.maximize

# Minimize the window

def maximize  
set\_window\_state :SW\_MAXIMIZE  
end  
def set\_window\_state(state)  
autoit.WinSetState title, ‘’, autoit.send(state)  
end  
def autoit  
Watir::autoit  
end

def self.autoit  
unless @@autoit  
begin  
@@autoit = WIN32OLE.new(‘AutoItX3.Control’)  
rescue WIN32OLERuntimeError  
\_register(‘AutoItX3.dll’)  
@@autoit = WIN32OLE.new(‘AutoItX3.Control’)  
end  
end  
@@autoit  
end

Version:  
gem 0.9.4  
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]
