[wtr-general] Re: What is the default element and page wait in Watir. Do we have to explicitly set PageObject.default_element_wait?
The PageObject::Elements::Div#wait_until just calls the underlying Watir::Div#wait_until method, but with different default values (ie the timeout). For the returned object: * Watir::Div#wait_until is set to return itself - ie the Watir::Div. * PageObject::Elements::Div#wait_until simply returns whatever Watir::Div#wait_until returned - ie the Watir::Div. Arguably, Page-Object should also start returning itself, so it can allow #wait_until methods to be chained. Justin On Tuesday, April 16, 2019 at 9:08:08 PM UTC-4, NaviHan wrote: > > In fact I have printed three classes > > puts applied_voucher_list_element.class > puts applied_voucher_list_element.element.class > puts applied_voucher_list_element.wait_until(&:present?).class > > and got > > > PageObject::Elements::Div > Watir::Div > Watir::Div > > > How is applied_voucher_list_element.wait_until(&:present?).class returning > Watir::Div? This should have been calling the wait_until methods of > PageObject calss and returned PageObject::Div? > > On Monday, 15 April 2019 09:29:57 UTC+10, NaviHan wrote: >> >> The automation code in our project uses PageObject and yesterday's >> nightly build shows a failure. >> >> [31m timed out after 10 seconds, waiting for true condition on >> #"slide-dialog-container-cart-page", >> :tag_name=>"div"}> (Watir::Wait::TimeoutError) [0m >> >> >> On checking hooks I found a statement >> >> PageObject.default_element_wait=(10) >> >> >> As per my undersatnding Watir has its own inbuilt page and element level >> waits which is a default of 30 seconds? >> And the above statement over rides that to 10 seconds? >> >> Please correct me if Im wrong. >> >> Cheers >> > -- -- Before posting, please read https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[wtr-general] Re: What is the default element and page wait in Watir. Do we have to explicitly set PageObject.default_element_wait?
In fact I have printed three classes puts applied_voucher_list_element.class puts applied_voucher_list_element.element.class puts applied_voucher_list_element.wait_until(&:present?).class and got PageObject::Elements::Div Watir::Div Watir::Div How is applied_voucher_list_element.wait_until(&:present?).class returning Watir::Div? This should have been calling the wait_until methods of PageObject calss and returned PageObject::Div? On Monday, 15 April 2019 09:29:57 UTC+10, NaviHan wrote: > > The automation code in our project uses PageObject and yesterday's nightly > build shows a failure. > > [31m timed out after 10 seconds, waiting for true condition on > #"slide-dialog-container-cart-page", > :tag_name=>"div"}> (Watir::Wait::TimeoutError) [0m > > > On checking hooks I found a statement > > PageObject.default_element_wait=(10) > > > As per my undersatnding Watir has its own inbuilt page and element level > waits which is a default of 30 seconds? > And the above statement over rides that to 10 seconds? > > Please correct me if Im wrong. > > Cheers > -- -- Before posting, please read https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[wtr-general] Re: What is the default element and page wait in Watir. Do we have to explicitly set PageObject.default_element_wait?
Hi Justin Also please note the error I was getting as I mention in the original post [31m timed out after 10 seconds, waiting for true condition on #"slide-dialog-container-cart-page", :tag_name=>"div"}> (Watir::Wait::TimeoutError) [0m Watir::Div timed out after 10 seconds. The 10 seconds because I was using defualt_element_wait.Which doesn't match PageObject.default_element_wait=(10) On Monday, 15 April 2019 09:29:57 UTC+10, NaviHan wrote: > > The automation code in our project uses PageObject and yesterday's nightly > build shows a failure. > > [31m timed out after 10 seconds, waiting for true condition on > #"slide-dialog-container-cart-page", > :tag_name=>"div"}> (Watir::Wait::TimeoutError) [0m > > > On checking hooks I found a statement > > PageObject.default_element_wait=(10) > > > As per my undersatnding Watir has its own inbuilt page and element level > waits which is a default of 30 seconds? > And the above statement over rides that to 10 seconds? > > Please correct me if Im wrong. > > Cheers > -- -- Before posting, please read https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[wtr-general] Re: What is the default element and page wait in Watir. Do we have to explicitly set PageObject.default_element_wait?
Hi Justin It a bit confusing... For example I have defined a PageObject element as div(:applied_voucher_list, :class => 'applied-evouchers') When I print the class of it puts applied_voucher_list_element.wait_until(&:present?).class Im getting Watir::Div I would expect this to return PageObject::Div? On Monday, 15 April 2019 09:29:57 UTC+10, NaviHan wrote: > > The automation code in our project uses PageObject and yesterday's nightly > build shows a failure. > > [31m timed out after 10 seconds, waiting for true condition on > #"slide-dialog-container-cart-page", > :tag_name=>"div"}> (Watir::Wait::TimeoutError) [0m > > > On checking hooks I found a statement > > PageObject.default_element_wait=(10) > > > As per my undersatnding Watir has its own inbuilt page and element level > waits which is a default of 30 seconds? > And the above statement over rides that to 10 seconds? > > Please correct me if Im wrong. > > Cheers > -- -- Before posting, please read https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[wtr-general] Re: What is the default element and page wait in Watir. Do we have to explicitly set PageObject.default_element_wait?
Hi Navi, 1) It would depend on who is calling the method - ie a Watir::Element vs a PageObject::Element. Generally you would be working with PageObject::Element, so you would be calling the Page-Object version. The recent versions of Page-Object forward missing methods directly to the Watir browser/element, which has clouded things a bit. For finding elements you can technically call Watir methods directly, which returns Watir::Elements, which means you would get Watir's version of the method. If you want to double-check which version is being called, check the class of your caller. 2) Calling `element.exists?` will not do any waiting - neither Watir or Page-Object's timeouts will apply. The default_element_wait will only apply if you did page-object's #check_exists (returns true as soon as the element exists, otherwise returns false when the timeout has elapsed). Justin On Tuesday, April 16, 2019 at 1:05:27 AM UTC-4, NaviHan wrote: > > Hi Justin > > I have two questions here.. > > 1. > Im use *wait_until(&:present) *a lot. > > I see *wait_until* is a method which is present in Watir and PageObject > and as you said *wait_until of PageObject *depends on > *default_element_wait* > > Do you know which method is invoked when I call a *wait_until(&:present) *the > Watir one or PageObject one? > > I have commented out *default_element_wait *in hooks. The nightly suite > hasnt run yet. So not sure about the impact. > > # PageObject.default_element_wait=(10) > > > So if the PageObject one is invoked then lots of tests will fail > 2. > > If I check for an elements existence like > *element.exists? * > As watir doesnt wait here do you suggest leaving default_element_wait to > say 30 seconds? > > Cheers > Navi > > > On Monday, 15 April 2019 09:29:57 UTC+10, NaviHan wrote: >> >> The automation code in our project uses PageObject and yesterday's >> nightly build shows a failure. >> >> [31m timed out after 10 seconds, waiting for true condition on >> #"slide-dialog-container-cart-page", >> :tag_name=>"div"}> (Watir::Wait::TimeoutError) [0m >> >> >> On checking hooks I found a statement >> >> PageObject.default_element_wait=(10) >> >> >> As per my undersatnding Watir has its own inbuilt page and element level >> waits which is a default of 30 seconds? >> And the above statement over rides that to 10 seconds? >> >> Please correct me if Im wrong. >> >> Cheers >> > -- -- Before posting, please read https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[wtr-general] Re: What is the default element and page wait in Watir. Do we have to explicitly set PageObject.default_element_wait?
Hi Justin I have two questions here.. 1. Im use *wait_until(&:present) *a lot. I see *wait_until* is a method which is present in Watir and PageObject and as you said *wait_until of PageObject *depends on *default_element_wait* Do you know which method is invoked when I call a *wait_until(&:present) *the Watir one or PageObject one? I have commented out *default_element_wait *in hooks. The nightly suite hasnt run yet. So not sure about the impact. # PageObject.default_element_wait=(10) So if the PageObject one is invoked then lots of tests will fail 2. If I check for an elements existence like *element.exists? * As watir doesnt wait here do you suggest leaving default_element_wait to say 30 seconds? Cheers Navi On Monday, 15 April 2019 09:29:57 UTC+10, NaviHan wrote: > > The automation code in our project uses PageObject and yesterday's nightly > build shows a failure. > > [31m timed out after 10 seconds, waiting for true condition on > #"slide-dialog-container-cart-page", > :tag_name=>"div"}> (Watir::Wait::TimeoutError) [0m > > > On checking hooks I found a statement > > PageObject.default_element_wait=(10) > > > As per my undersatnding Watir has its own inbuilt page and element level > waits which is a default of 30 seconds? > And the above statement over rides that to 10 seconds? > > Please correct me if Im wrong. > > Cheers > -- -- Before posting, please read https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[wtr-general] Re: What is the default element and page wait in Watir. Do we have to explicitly set PageObject.default_element_wait?
Page-Object introduces its own couple of waits (https://github.com/cheezy/page-object/blob/master/lib/page-object.rb#L87-L113): - default_page_wait which has a default of 30 and - default_element_wait which has a default of 5 The default_element_wait will impact the Element methods #check_exists, #check_visible, #when_present, #when_not_present and #wait_until. Also impacts some of accessors for waiting for a page to load. Setting Page-Object's default_element_wait only sometimes overrides Watir's in-built waiting. For example: - Watir does not do any waiting before checking if an element exists, where as Page-Object's #check_exists wraps the call in a wait (using default_element_wait). - In most cases, using #when_present will be overriding - eg element.when_present.click. Page-Object's #when_present wait effectively takes precedence over Watir's in-built one. That said, I would argue you should be removing the #when_present calls (they are a relic from before Watir had the in-built waiting). Unfortunately not a black-and-white answer. Though again more evidence that we need to re-visit what Page-Object is doing given how much Watir has evolved. Justin On Sunday, April 14, 2019 at 7:29:57 PM UTC-4, NaviHan wrote: > > The automation code in our project uses PageObject and yesterday's nightly > build shows a failure. > > [31m timed out after 10 seconds, waiting for true condition on > #"slide-dialog-container-cart-page", > :tag_name=>"div"}> (Watir::Wait::TimeoutError) [0m > > > On checking hooks I found a statement > > PageObject.default_element_wait=(10) > > > As per my undersatnding Watir has its own inbuilt page and element level > waits which is a default of 30 seconds? > And the above statement over rides that to 10 seconds? > > Please correct me if Im wrong. > > Cheers > -- -- Before posting, please read https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.