Ack, I was wrong about that.

`#wait_while_present` is equivalent to this:

Watir::Wait.while do
    browser.element(class: 'here').present?
end

As soon as it does not find the element it is waiting while for, it will 
exit the waiting loop. If you want to wait for it to go away then come 
back, you'll need to wait_while_present then wait_until_present.


On Thursday, September 13, 2018 at 4:33:27 PM UTC-7, NaviHan wrote:
>
> Hi Titus
>
> This statement
>
> These are effectively equivalent because it is ignoring cache:
>
> my_element.wait_while_present
> browser.element(class: 'here').wait_while(&:present)
>
>
> Do you mean wait_while_present = wait_while(&:present)  --> "present 
> without question mark"
>
> To conclude
>
> wait_while_present will successfully wait when the class transition as 
> "here" to "not-here" to "here"
>
> Cheers
>
> On Tuesday, 11 September 2018 14:52:33 UTC+10, NaviHan wrote:
>>
>> This is something that keeps me a bit sceptic when I write and read the 
>> automation code in my project.
>> This used PageObjects.
>>
>> I have seen extensive use of element referces, for example 
>>
>> button(:add_to_bag, :css => '#add-to-cart')
>> add_to_bag.element.when_present.click
>>
>>
>>
>> instead of 
>>
>> add_to_bag 
>>
>> which directly clicks the element
>>
>> I have also seen extensive use of referencing elements using 
>> <element>.when_present, <element>.wait_until_present etc
>>
>> Im confused where we should draw the line when deciding to reference the 
>> element and actually using it(as in directly calling "add_o_bag" in the 
>> above example to click the element.
>>
>> Any thoughts?
>>
>>
>>

-- 
-- 
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.

Reply via email to