Hi Titus

I read a wondeful article about the enumerable methods, Any, All, None & 
One.

https://www.rubyguides.com/2018/10/any-all-none-one/

For the particular example in the first post, I used the below code to just 
return if wishlist is empty(No buttons are present on the wishlist page) 
and this works.

return if !products_on_wishlist_elements.any?

My doubt is 

When you define the elements as buttons(:products_on_wishlist, :class => 
'product-quick-add') and there are no buttons on wishlist page, is the 
collection array set to empty or nil ?

Because 
[nil].any?  

also returns false

Cheers
NaviHan

On Wednesday, 27 March 2019 11:08:54 UTC+11, NaviHan wrote:
>
> Hi 
>
> I have a collections of buttons defined as  is the element 
>
 

>
> buttons(:products_on_wishlist, :class => 'product-quick-add')
>
>
>
> Basically they represent the products on wishlist 
>
> The page can have
> 1. No products (no buttons)
> 2. One product (1 button)
> 3. More than one products (more than 1 button)
>
> I need to check if the wishlist page is empty. Basically I want to check 
> if the button is present on not.
> Because the button is defined as a collection
>
>
> products_on_wishlist_elemets.present? 
>
>
> is not working.
>
> Is there a way to check if the collection is present or not?
>
>
>

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