<div class="row add-wishlist-remove-buttons">

<div class="small-7 large-7 xlarge-3 xxlarge-2 column wishlist-wrapper">
<button type="button" data-variationgroup="2002690-02" 
data-productname="Woven Allycia Cold Shoulder Frill Wrap Dress" 
class="pointer wishlist-container">
<span class="icon icon-wishlist-bag-heart"></span>
<span class="underline align-text">Move to wishlist</span>
</button>
</div>

<div class="medium-5 xlarge-6 xxlarge-2   column">
<button type="submit" class="pointer remove-container" 
name="dwfrm_cart_shipments_i0_items_i1_deleteProduct" value="9351533603802" 
data-item-position="1">
<span class="icon icon-cross-standard-small-black"></span>
<span class="underline align-text remove-button-text">Remove</span>
</button>
</div>

</div>

In the above html, if I represent the button 
*name="dwfrm_cart_shipments_i0_items_i1_deleteProduct"* as  
*buttons(:remove_line_items, 
:name => /deleteProduct/)* then can I reach the other button with 
*data-variationgroup="2002690-02" *using the preceding_sibling?

remove_line_items_elements.find{|el| el.value == 
"9351785508221"}.preceding_sibling.present?

Doesnt work though. If that the case I could have solved the original issue 
with this code..


On Monday, 15 April 2019 16:03:51 UTC+10, NaviHan wrote:
>
> The shopping cart has two products, normal product and personalised product
>
> Against each normal product there is a "move to wishlist" button and there 
> is no "move to wishlist" button for personalised product.
>
> The test needs to validate the absence of the "move to wishlilist" button 
> for the personalised product. 
>
> The move to wishlist buttons are idetified by the collection
>
> buttons(:add_to_wishlist , :class => 'wishlist-container')
>
>
>
> and each button is identified by the attribute "data-variationgroup" which 
> containes the product ID passed to the test as a table
>
> The page source of 1st product which is a personalised one and hence no 
> move to wishlist button.
>
>
> <div class="row add-wishlist-remove-buttons">
> <div class="medium-5 xlarge-6 xxlarge-2 small-offset-7 large-offset-5 
> xlarge-offset-0  column">
> <button type="submit" class="pointer remove-container" name=
> "dwfrm_cart_shipments_i0_items_i0_deleteProduct" value="9351785508221" 
> data-item-position="0">
> <span class="icon icon-cross-standard-small-black"></span>
> <span class="underline align-text remove-button-text">Remove</span>
> </button>
> </div>
>
> </div>
>
>
>
> 2nd product which is a normal product
>
>
> <div class="row add-wishlist-remove-buttons">
>
>
> <div class="small-7 large-7 xlarge-3 xxlarge-2 column wishlist-wrapper">
> <button type="button" data-variationgroup="2002690-02" 
> data-productname="Woven 
> Allycia Cold Shoulder Frill Wrap Dress" class="pointer wishlist-container"
> >
> <span class="icon icon-wishlist-bag-heart"></span>
> <span class="underline align-text">Move to wishlist</span>
> </button>
> </div>
>
> <div class="medium-5 xlarge-6 xxlarge-2   column">
> <button type="submit" class="pointer remove-container" name=
> "dwfrm_cart_shipments_i0_items_i1_deleteProduct" value="9351533603802" 
> data-item-position="1">
> <span class="icon icon-cross-standard-small-black"></span>
> <span class="underline align-text remove-button-text">Remove</span>
> </button>
> </div>
>
> </div>
>
>
> What would be the best way to check the absence of the "move to wishlist" 
> button for the 1st product?
>
> One of my team members is using a logic
>
>   def check_move_to_wishlist_link_presence product
>     add_to_wishlist_elements.find{|el| el.data_variationgroup == product}.
> nil?
>   end
>
>
>
> this is calling nil on nil which return true.
>
> Is this a good way? I see an issue where this passes even when the product 
> itself is not there
>
>

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