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
> #<Watir::Div: located: false; {:class=>"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.
[email protected]
http://groups.google.com/group/watir-general
[email protected]
---
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 [email protected].
For more options, visit https://groups.google.com/d/optout.