NaviHan
2018-09-20 10:50:21 UTC
I have a bag page where I have applied two coupons. Once the coupons are
applied the source looks like this
<div class="small-12 all-applied-coupons column promo-codes-list">
<h5 class="applied-promo-codes-title">Applied codes:</h5>
<div class="row promo-code-row">
<div class="small-8 large-6 xxlarge-8 column small-text-left
promo-code-column">
<span class="promo-code-item">
9840150120702065
</span>
</div>
<div class="column small-text-right">
<button type="button" class="pointer" value="9840150120702065" id=
"delete-coupon">
<span class="icon icon-cross-standard-small-black"></span>
<span class="underline align-text remove-promo-code">Remove</span>
</button>
</div>
</div>
<div class="row promo-code-row">
<div class="small-8 large-6 xxlarge-8 column small-text-left
promo-code-column">
<span class="promo-code-item">
autotest_order
</span>
</div>
<div class="column small-text-right">
<button type="button" class="pointer" value="autotest_order" id=
"delete-coupon">
<span class="icon icon-cross-standard-small-black"></span>
<span class="underline align-text remove-promo-code">Remove</span>
</button>
</div>
</div>
</div>
There is a remove link(button) against each coupon. Basically my test
clicks these buttons to remove them
I have the page object defined as and the step def and method as follows
buttons(:delete_coupon, :id => 'delete-coupon')
And(/^the customer removes the coupons\/vouchers from Bag Page$/) do |table|
on(MybagPage) do |page|
@remove_voucher_list = table.hashes
@remove_voucher_list.each {|data|
page.remove_voucher_from_bag data['voucher_id']
}
end
def remove_voucher_from_bag coupon_id
delete_coupon_elements.find{|el| el.value.to_s == coupon_id.to_s}.click
end
The script removes the coupon "9840150120702065", but when trying to remove
the next coupon fails with folowing message
Watir::Exception::UnknownObjectException: timed out after 30 seconds,
waiting for #<Watir::Button: located: false; {:id=>"delete-coupon",
:tag_name=>"button", :index=>1}> to be located; Maybe look in an iframe?
./features/support/pages/Frontend/Cotton_On/Mybag_Page.rb:141:in `block in
remove_voucher_from_bag'
Any clue whats missing here?
--
--
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-***@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+***@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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
applied the source looks like this
<div class="small-12 all-applied-coupons column promo-codes-list">
<h5 class="applied-promo-codes-title">Applied codes:</h5>
<div class="row promo-code-row">
<div class="small-8 large-6 xxlarge-8 column small-text-left
promo-code-column">
<span class="promo-code-item">
9840150120702065
</span>
</div>
<div class="column small-text-right">
<button type="button" class="pointer" value="9840150120702065" id=
"delete-coupon">
<span class="icon icon-cross-standard-small-black"></span>
<span class="underline align-text remove-promo-code">Remove</span>
</button>
</div>
</div>
<div class="row promo-code-row">
<div class="small-8 large-6 xxlarge-8 column small-text-left
promo-code-column">
<span class="promo-code-item">
autotest_order
</span>
</div>
<div class="column small-text-right">
<button type="button" class="pointer" value="autotest_order" id=
"delete-coupon">
<span class="icon icon-cross-standard-small-black"></span>
<span class="underline align-text remove-promo-code">Remove</span>
</button>
</div>
</div>
</div>
There is a remove link(button) against each coupon. Basically my test
clicks these buttons to remove them
I have the page object defined as and the step def and method as follows
buttons(:delete_coupon, :id => 'delete-coupon')
And(/^the customer removes the coupons\/vouchers from Bag Page$/) do |table|
on(MybagPage) do |page|
@remove_voucher_list = table.hashes
@remove_voucher_list.each {|data|
page.remove_voucher_from_bag data['voucher_id']
}
end
def remove_voucher_from_bag coupon_id
delete_coupon_elements.find{|el| el.value.to_s == coupon_id.to_s}.click
end
The script removes the coupon "9840150120702065", but when trying to remove
the next coupon fails with folowing message
Watir::Exception::UnknownObjectException: timed out after 30 seconds,
waiting for #<Watir::Button: located: false; {:id=>"delete-coupon",
:tag_name=>"button", :index=>1}> to be located; Maybe look in an iframe?
./features/support/pages/Frontend/Cotton_On/Mybag_Page.rb:141:in `block in
remove_voucher_from_bag'
Any clue whats missing here?
--
--
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-***@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+***@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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.