how to resize browser to different sizes or to maximize

950 views
Skip to first unread message

c w

unread,
May 1, 2017, 10:57:29 AM5/1/17
to watir-...@googlegroups.com
Hi ! I need tour help!

I use a code used to be working but with all changes it looks like is no longer working.

I try to goole but I haven't find the answer.

I use testgen framework and really doesn't mateer. It looks like I cannot resize the browser window to different sizez or even to maximize.

Please can one tell me what has been changed and what I should update. I have no idea where the driver resides now.

I use this



require 'watir'
require "rubygems"

Before do
  @browser = Watir::Browser.new :chrome
puts "................................................."
 #have to find out how to maximize the browser - it looks like the old way no longer working
 #@browser.window.maximize   #this used to be working

@browser.driver.manage().window().maximize   # no longer working
@browser.driver.manage.window.resize_to(900,900)    # not working


end


Titus Fortner

unread,
May 1, 2017, 11:04:51 AM5/1/17
to Watir General
Which operating system are you running on? Browser version & driver version?

c w

unread,
May 1, 2017, 12:55:44 PM5/1/17
to watir-...@googlegroups.com
Windows 7
Chrome Version 57.0.2987.133 (64-bit)

I am using the latest chrome driver 

ChromeDriver 2.29


Inline image 1



On Mon, May 1, 2017 at 11:04 AM, Titus Fortner <titusf...@gmail.com> wrote:
Which operating system are you running on? Browser version & driver version?

--
--
Before posting, please read http://watir.com/support. In short: search before you ask, be nice.

watir-...@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscribe@googlegroups.com


---
You received this message because you are subscribed to the Google Groups "Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email to watir-general+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Paul Denize

unread,
May 2, 2017, 2:11:15 AM5/2/17
to Watir General
 This should work

@browser.driver.window.maximize  
@browser.driver.window.resize_to(900,900)   
 

c w

unread,
May 2, 2017, 9:26:21 AM5/2/17
to watir-...@googlegroups.com
I believe that the problem comes for what package should I require.

I use only
require "watir"

I get an error where the window is not defined.

Do you know what other packages should I require?


A few years ago we used to use:
require 'watir-webdriver'


I am still confused about changes.  


Inline image 1

--

Raja gopalan

unread,
May 2, 2017, 10:00:58 AM5/2/17
to Watir General

hi, 

The below code is working for me in Firefox!

@browser.driver.manage.window.maximize
@browser.driver.manage.window.resize_to(900,900)

require 'watir' is enough now, require 'watir-webdriver' is not necessary now. The recent watir is not a meta gem which doesn't choose betwen watir-classic and watir-webdriver, it's lies on selenium-webdriver completely.



On Tuesday, May 2, 2017 at 6:56:21 PM UTC+5:30, christina wrote:
I believe that the problem comes for what package should I require.

I use only
require "watir"

I get an error where the window is not defined.

Do you know what other packages should I require?


A few years ago we used to use:
require 'watir-webdriver'


I am still confused about changes.  


Inline image 1
On Tue, May 2, 2017 at 2:11 AM, Paul Denize <deniz...@gmail.com> wrote:
 This should work

@browser.driver.window.maximize  
@browser.driver.window.resize_to(900,900)   
 

--
--
Before posting, please read http://watir.com/support. In short: search before you ask, be nice.
 
watir-...@googlegroups.com
http://groups.google.com/group/watir-general


---
You received this message because you are subscribed to the Google Groups "Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email to watir-genera...@googlegroups.com.

Raja gopalan

unread,
May 2, 2017, 10:01:26 AM5/2/17
to Watir General
This is the wrong coding

Right one is below

@browser.driver.manage.window.maximize
@browser.driver.manage.window.resize_to(900,900)


Raja gopalan

unread,
May 2, 2017, 10:04:18 AM5/2/17
to Watir General
you don't have use

@browser.driver.manage.window.maximize

because you are invoking the driver to write selenium code but watir giving you another syntax which will automatically invokes the above code

@browser.window.maximize

The definition of maximize includes the above code, you can see here

def maximize
 
use { @driver.manage.window.maximize }
end



On Tuesday, May 2, 2017 at 6:56:21 PM UTC+5:30, christina wrote:
I believe that the problem comes for what package should I require.

I use only
require "watir"

I get an error where the window is not defined.

Do you know what other packages should I require?


A few years ago we used to use:
require 'watir-webdriver'


I am still confused about changes.  


Inline image 1
On Tue, May 2, 2017 at 2:11 AM, Paul Denize <deniz...@gmail.com> wrote:
 This should work

@browser.driver.window.maximize  
@browser.driver.window.resize_to(900,900)   
 

--
--
Before posting, please read http://watir.com/support. In short: search before you ask, be nice.
 
watir-...@googlegroups.com
http://groups.google.com/group/watir-general


---
You received this message because you are subscribed to the Google Groups "Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email to watir-genera...@googlegroups.com.

c w

unread,
May 2, 2017, 10:21:59 AM5/2/17
to watir-...@googlegroups.com
Do you know if the ruby version matter? 



ruby 2.3.3p22 (2016-11-21 revision 56859) [x64-mingw32]


Please can you double check what ruby version you have.



---
You received this message because you are subscribed to the Google Groups "Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email to watir-general+unsubscribe@googlegroups.com.

Raja gopalan

unread,
May 2, 2017, 10:30:37 AM5/2/17
to Watir General
I am using the same version

I am using Firefox not chrome , Try in Firefox once.
Capture.PNG
Reply all
Reply to author
Forward
0 new messages