Re: [wtr-general] waiting using implicit_wait with watir-webdriver

2011-10-05 Thread Rahul Sharma
Hi Joshua,

Can you please tell where exactly this implicit wait can be defined? Would
you put this in the environment file? Also, I am currently using as you
mentioned quite a lot of Watir::Wait.until{...} and wait_until_present in my
scripts. Does this implicit wait value helps trying for 3 seconds or doe sit
actually wait for 3 seconds before trying?

On 4 October 2011 21:36, jw joshuawal...@gmail.com wrote:

 After searching for a long time, Alister Scott finally clued me in
 that watir-webdriver does in fact include a method that I thought was
 only available in selenium (or selenium webdriver).  Instead of doing
 a wait_until_present and then doing a click, you can just (globally)
 do a

 myBrowser.driver.manage.timeouts.implicit_wait=3

 so that each access of a DOM element (click, set, text, etc.) will try
 for X seconds before failing with
 Watir::Exception::UnknownObjectException: unable to locate element

 This is huge for me.  Coming from watir where waiting was not
 necessary, I  (instead of doing tons of explicit waits) had basically
 wrapped all calls with rescue/sleep statements that tried 3 times
 before bubbling up the exception.

 I'm just posting this because I didn't find documentation for this
 anywhere and I'd expect many people to have a similar need as I had.

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

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




-- 
Regards,

Rahul Sharma
Ph:+44 7800 736851

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

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


Re: [wtr-general] waiting using implicit_wait with watir-webdriver

2011-10-05 Thread Alister Scott
after you create a browser, simply set the wait:

require 'watir-webdriver'
b = Watir::Browser.new
b.driver.manage.timeouts.implicit_wait=3 

It will wait *up to* 3 seconds before complaining it can't find the element. 
If it finds it immediately, there is no wait.

Alister

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

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


Re: [wtr-general] waiting using implicit_wait with watir-webdriver

2011-10-05 Thread bruce.posey
Very good thank you for posting this!



On Tue, Oct 4, 2011 at 3:36 PM, jw joshuawal...@gmail.com wrote:

 After searching for a long time, Alister Scott finally clued me in
 that watir-webdriver does in fact include a method that I thought was
 only available in selenium (or selenium webdriver).  Instead of doing
 a wait_until_present and then doing a click, you can just (globally)
 do a

 myBrowser.driver.manage.timeouts.implicit_wait=3

 so that each access of a DOM element (click, set, text, etc.) will try
 for X seconds before failing with
 Watir::Exception::UnknownObjectException: unable to locate element

 This is huge for me.  Coming from watir where waiting was not
 necessary, I  (instead of doing tons of explicit waits) had basically
 wrapped all calls with rescue/sleep statements that tried 3 times
 before bubbling up the exception.

 I'm just posting this because I didn't find documentation for this
 anywhere and I'd expect many people to have a similar need as I had.

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

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


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

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


Re: [wtr-general] waiting using implicit_wait with watir-webdriver

2011-10-05 Thread Rahul Sharma
Hi Jari,

We have been using explicit waits for a long time and one drawback that we
have encountered is when the tests fail. The timeout I believe with
Watir::Wait.until is 30 secs. If the test was going to fail it will still
try to locate the element(correct me if I am wrong!). Should this be cut
down to less seconds?

On 5 October 2011 13:45, bruce.posey bruce.po...@gmail.com wrote:

 Very good thank you for posting this!



 On Tue, Oct 4, 2011 at 3:36 PM, jw joshuawal...@gmail.com wrote:

 After searching for a long time, Alister Scott finally clued me in
 that watir-webdriver does in fact include a method that I thought was
 only available in selenium (or selenium webdriver).  Instead of doing
 a wait_until_present and then doing a click, you can just (globally)
 do a

 myBrowser.driver.manage.timeouts.implicit_wait=3

 so that each access of a DOM element (click, set, text, etc.) will try
 for X seconds before failing with
 Watir::Exception::UnknownObjectException: unable to locate element

 This is huge for me.  Coming from watir where waiting was not
 necessary, I  (instead of doing tons of explicit waits) had basically
 wrapped all calls with rescue/sleep statements that tried 3 times
 before bubbling up the exception.

 I'm just posting this because I didn't find documentation for this
 anywhere and I'd expect many people to have a similar need as I had.

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

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


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

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




-- 
Regards,

Rahul Sharma
Ph:+44 7800 736851

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

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


Re: [wtr-general] waiting using implicit_wait with watir-webdriver

2011-10-05 Thread Jari Bakken
On Wed, Oct 5, 2011 at 4:08 PM, Rahul Sharma rahulsharma@gmail.comwrote:

 Hi Jari,

 We have been using explicit waits for a long time and one drawback that we
 have encountered is when the tests fail. The timeout I believe with
 Watir::Wait.until is 30 secs. If the test was going to fail it will still
 try to locate the element(correct me if I am wrong!). Should this be cut
 down to less seconds?



I'm not sure how that's worse than implicit waits. With explicit waits, it
will at least only happen when you explicitly tell it to, not for *every*
element lookup. You can also pass your preferred timeout as the first
argument to all the wait methods.

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

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


[wtr-general] waiting using implicit_wait with watir-webdriver

2011-10-04 Thread jw
After searching for a long time, Alister Scott finally clued me in
that watir-webdriver does in fact include a method that I thought was
only available in selenium (or selenium webdriver).  Instead of doing
a wait_until_present and then doing a click, you can just (globally)
do a

myBrowser.driver.manage.timeouts.implicit_wait=3

so that each access of a DOM element (click, set, text, etc.) will try
for X seconds before failing with
Watir::Exception::UnknownObjectException: unable to locate element

This is huge for me.  Coming from watir where waiting was not
necessary, I  (instead of doing tons of explicit waits) had basically
wrapped all calls with rescue/sleep statements that tried 3 times
before bubbling up the exception.

I'm just posting this because I didn't find documentation for this
anywhere and I'd expect many people to have a similar need as I had.

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

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