Discussion:
[wtr-general] how to resize browser to different sizes or to maximize
c w
2017-05-01 14:57:26 UTC
Permalink
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
--
--
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+***@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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Titus Fortner
2017-05-01 15:04:51 UTC
Permalink
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+***@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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
c w
2017-05-01 16:55:39 UTC
Permalink
Windows 7
Chrome Version 57.0.2987.133 (64-bit)

I am using the latest chrome driver
*ChromeDriver 2.29
<https://chromedriver.storage.googleapis.com/index.html?path=2.29/>*

[image: Inline image 1]
Post by Titus Fortner
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.
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
For more options, visit https://groups.google.com/d/optout.
--
--
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+***@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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Paul Denize
2017-05-02 06:11:15 UTC
Permalink
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
watir-general+***@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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
c w
2017-05-02 13:26:18 UTC
Permalink
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.


[image: Inline image 1]
Post by Paul Denize
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.
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
For more options, visit https://groups.google.com/d/optout.
--
--
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+***@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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Raja gopalan
2017-05-02 14:00:57 UTC
Permalink
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.
Post by c w
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?
require 'watir-webdriver'
I am still confused about changes.
[image: Inline image 1]
Post by Paul Denize
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.
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
For more options, visit https://groups.google.com/d/optout.
--
--
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+***@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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
c w
2017-05-02 14:21:54 UTC
Permalink
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.
Post by Raja gopalan
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.
Post by c w
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?
require 'watir-webdriver'
I am still confused about changes.
[image: Inline image 1]
Post by Paul Denize
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.
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
For more options, visit https://groups.google.com/d/optout.
--
--
Before posting, please read http://watir.com/support. In short: search
before you ask, be nice.
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
For more options, visit https://groups.google.com/d/optout.
--
--
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+***@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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Raja gopalan
2017-05-02 14:30:37 UTC
Permalink
I am using the same version

I am using Firefox not chrome , Try in Firefox once.
Post by c w
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.
Post by Raja gopalan
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.
Post by c w
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?
require 'watir-webdriver'
I am still confused about changes.
[image: Inline image 1]
Post by Paul Denize
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.
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
For more options, visit https://groups.google.com/d/optout.
--
--
Before posting, please read http://watir.com/support. In short: search
before you ask, be nice.
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
For more options, visit https://groups.google.com/d/optout.
--
--
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+***@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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Raja gopalan
2017-05-02 14:04:18 UTC
Permalink
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
Post by c w
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?
require 'watir-webdriver'
I am still confused about changes.
[image: Inline image 1]
Post by Paul Denize
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.
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
For more options, visit https://groups.google.com/d/optout.
--
--
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+***@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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Raja gopalan
2017-05-02 14:01:25 UTC
Permalink
This is the wrong coding

Right one is below

@browser.driver.manage.window.maximize
@browser.driver.manage.window.resize_to(900,900)
Post by Paul Denize
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
watir-general+***@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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...