Discussion:
[wtr-general] Trouble reading the text from Popup , Using Watir and Pageobject
NaviHan
2018-08-03 05:12:45 UTC
Permalink
I have a functionality where I click an a link from an email a voucher gets
added to the shopping cart and a pop up appears with a message. Im trying
to assert the text in the popup
I have defined the element as

div(:cta_description, :css => '.homepage-clicktoactiavte-description')

Tried to use a mix of Watir and Pageobejct to read the text. The below code
works 5 out of 10 times.

@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
return @rewards_popup_txt


Tried using, which doesnt even set the @reward_popup_txt and shows error


if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
return @rewards_popup_txt

Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in `
rewards_popup_description'

Any stable way to do the job?
--
--
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.
Titus Fortner
2018-08-03 05:46:32 UTC
Permalink
Watir::Wait methods take blocks, not parameters, so I'm not sure why it isn't failing more directly

Try:

cta_description_element.wait_until(&:present?).text.gsub(/[^$,.A-Za-z0-9]/," ")
Post by NaviHan
I have a functionality where I click an a link from an email a voucher
gets added to the shopping cart and a pop up appears with a message. Im
trying to assert the text in the popup
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below
code works 5 out of 10 times.
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in `
rewards_popup_description'
Any stable way to do the job?
--
--
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.
NaviHan
2018-08-06 00:26:55 UTC
Permalink
Hi Titus

This actually works. Im yet to configure the script in Jenkins and verify
because due to some reason the initial code worked sometimes on local but
failed in Jenkis on all instances

@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text"


Im eager to know what is the difference between "(&:present?)" and "(present)?"

Cheers
Post by NaviHan
I have a functionality where I click an a link from an email a voucher
gets added to the shopping cart and a pop up appears with a message. Im
trying to assert the text in the popup
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below
code works 5 out of 10 times.
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in `
rewards_popup_description'
Any stable way to do the job?
--
--
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.
Titus Fortner
2018-08-06 00:42:50 UTC
Permalink
Yeah, ideally you shouldn't need to use the class directly since the methods are included in the element class. The errors are better when you do the code I suggested.

As far as the `#to_proc` syntax, it's discussed in our watir 6 faq. http://watir.com/watir-6-faq/#I
--
--
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.
NaviHan
2018-08-06 01:22:42 UTC
Permalink
Thanks Titus

Just wondering the difference between wait_until and wait_while. Do they
bot do the same thing?
Post by NaviHan
I have a functionality where I click an a link from an email a voucher
gets added to the shopping cart and a pop up appears with a message. Im
trying to assert the text in the popup
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below
code works 5 out of 10 times.
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in `
rewards_popup_description'
Any stable way to do the job?
--
--
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.
Titus Fortner
2018-08-06 03:37:51 UTC
Permalink
`#wait_until` waits for a truthy condition; `#wait_while` waits for a
falsey condition.
Post by NaviHan
Thanks Titus
Just wondering the difference between wait_until and wait_while. Do they
bot do the same thing?
Post by NaviHan
I have a functionality where I click an a link from an email a voucher
gets added to the shopping cart and a pop up appears with a message. Im
trying to assert the text in the popup
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below
code works 5 out of 10 times.
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in `
rewards_popup_description'
Any stable way to do the job?
--
--
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.
NaviHan
2018-08-06 13:23:05 UTC
Permalink
Thanks Titus

The script again failed in Jenkins box but it passed in local machine. What
could be the reason? Im yet to get the details of the box like OS etc. Used
the same code snippet

cta_description_element.wait_until(&:present?).text.gsub(/[^$,.A-Za-z0-9]/," ")


Also while working on a different script, I found something strange. The
below code snippet fails with reason as specified.
variation_groups_elements.map do |el|

Watir::Wait.until {el}.click if el.attribute('title').include? "#{color}"
end

Selenium::WebDriver::Error::UnknownError: unknown error: Element <a
class="swatchanchor"
href="https://ci.cottonon.com/AU/show-variation/?dwvar_2003013_color=2003013-05&amp;pid=2003013&amp;dwvar_2003013_size=XXS&amp;originalPid=2003013-05"
title="Select Colour: BLACK" data-attribute-type="color">...</a> is not
clickable at point (504, 64). Other element would receive the click: <div
class="loader-bg"></div>
(Session info: chrome=68.0.3440.84)
(Driver info: chromedriver=2.36.540470
(e522d04694c7ebea4ba8821272dbef4f9b818c91),platform=Windows NT 6.1.7601 SP1
x86_64)


I tried modifying the code as below expecting that the script waits for 3
second until it finds "el" but got the same error above

Watir::Wait.until(timeout = 3) {el}.click if el.attribute('title').include? "#{color}"


However putting a 1 second sleep before the statement passed. Wondering
what is the difference?

variation_groups_elements.map do |el|
sleep 1
Watir::Wait.until {el}.click if el.attribute('title').include? "#{color}"
end


Im so much confused about the Watir::Wait.until, wait_until, wait_while
methods. Putting a sleep instead gives more favorable outputs.

Thanks in advance
But putting a sleep before works fine. How are both different
Post by NaviHan
I have a functionality where I click an a link from an email a voucher
gets added to the shopping cart and a pop up appears with a message. Im
trying to assert the text in the popup
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below
code works 5 out of 10 times.
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in `
rewards_popup_description'
Any stable way to do the job?
--
--
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.
Titus Fortner
2018-08-06 19:57:39 UTC
Permalink
There are several reasons why tests can pass locally but fail
remotely. Sometimes the code is run at a different resolution. The
debugging process is going to be the same. Read the error message to
see what specifically is failing, and look at the full stack trace
(use `--backtrace`) to see the exact spot of failure. Create a
screenshot at the point of failure to see if anything is obvious (on
the wrong page, element is covered by another element, element isn't
loaded, etc, etc). If it might be an issue with the driver or the
waiting logic, you can turn on the Selenium or Watir logging.

I notice that your version of Chromedriver is not compatible with your
version of Chrome
(https://chromedriver.storage.googleapis.com/2.41/notes.txt).

As for clearing up the waiting confusion, let's start with, you should
never need to use Watir::Wait directly. I'm curious where you are
seeing examples for the code you are using because it will not work.
This code is waiting for the element after it is already attempting to
use the element.

Watir::Wait.until {el}.click if el.attribute('title').include? "#{color}"

This is probably the code you want:
element.wait_until { |el| el.title.include? color }
Post by NaviHan
Thanks Titus
The script again failed in Jenkins box but it passed in local machine. What could be the reason? Im yet to get the details of the box like OS etc. Used the same code snippet
cta_description_element.wait_until(&:present?).text.gsub(/[^$,.A-Za-z0-9]/," ")
Also while working on a different script, I found something strange. The below code snippet fails with reason as specified.
variation_groups_elements.map do |el|
Watir::Wait.until {el}.click if el.attribute('title').include? "#{color}"
end
Selenium::WebDriver::Error::UnknownError: unknown error: Element <a class="swatchanchor" href="https://ci.cottonon.com/AU/show-variation/?dwvar_2003013_color=2003013-05&amp;pid=2003013&amp;dwvar_2003013_size=XXS&amp;originalPid=2003013-05" title="Select Colour: BLACK" data-attribute-type="color">...</a> is not clickable at point (504, 64). Other element would receive the click: <div class="loader-bg"></div>
(Session info: chrome=68.0.3440.84)
(Driver info: chromedriver=2.36.540470 (e522d04694c7ebea4ba8821272dbef4f9b818c91),platform=Windows NT 6.1.7601 SP1 x86_64)
I tried modifying the code as below expecting that the script waits for 3 second until it finds "el" but got the same error above
Watir::Wait.until(timeout = 3) {el}.click if el.attribute('title').include? "#{color}"
However putting a 1 second sleep before the statement passed. Wondering what is the difference?
variation_groups_elements.map do |el|
sleep 1
Watir::Wait.until {el}.click if el.attribute('title').include? "#{color}"
end
Im so much confused about the Watir::Wait.until, wait_until, wait_while methods. Putting a sleep instead gives more favorable outputs.
Thanks in advance
But putting a sleep before works fine. How are both different
I have a functionality where I click an a link from an email a voucher gets added to the shopping cart and a pop up appears with a message. Im trying to assert the text in the popup
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below code works 5 out of 10 times.
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in `rewards_popup_description'
Any stable way to do the job?
--
--
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.
http://groups.google.com/group/watir-general
---
You received this message because you are subscribed to the Google Groups "Watir General" group.
For more options, visit https://groups.google.com/d/optout.
--
--
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.
NaviHan
2018-08-06 23:47:06 UTC
Permalink
Still having issues with wait

def select_variation_group(color)
variation_groups_elements.map do |element|
element.wait_until { |el| el.title.include? color }
element.click
end
end

Error
Watir::Wait::TimeoutError: timed out after 10 seconds, waiting for true
condition on #<Watir::Anchor: located: true; {:title=>/Select Colour:/,
:tag_name=>"a", :index=>0}>
Post by NaviHan
I have a functionality where I click an a link from an email a voucher
gets added to the shopping cart and a pop up appears with a message. Im
trying to assert the text in the popup
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below
code works 5 out of 10 times.
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in `
rewards_popup_description'
Any stable way to do the job?
--
--
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.
Titus Fortner
2018-08-06 23:56:30 UTC
Permalink
1. I need more of a stack trace than that. What method is calling wait?

2. I need to see more code. If you are locating an element with
`title: /Select Colour/` then it doesn't make sense to wait for the
title to include that value, clicking on it will automatically wait
for that condition to be true.

Did you take a screenshot at the point of the exception to verify that
the page is in the condition you need it to be in?
Post by NaviHan
Still having issues with wait
def select_variation_group(color)
variation_groups_elements.map do |element|
element.wait_until { |el| el.title.include? color }
element.click
end
end
Error
Watir::Wait::TimeoutError: timed out after 10 seconds, waiting for true condition on #<Watir::Anchor: located: true; {:title=>/Select Colour:/, :tag_name=>"a", :index=>0}>
I have a functionality where I click an a link from an email a voucher gets added to the shopping cart and a pop up appears with a message. Im trying to assert the text in the popup
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below code works 5 out of 10 times.
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in `rewards_popup_description'
Any stable way to do the job?
--
--
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.
http://groups.google.com/group/watir-general
---
You received this message because you are subscribed to the Google Groups "Watir General" group.
For more options, visit https://groups.google.com/d/optout.
--
--
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.
NaviHan
2018-08-07 00:39:24 UTC
Permalink
This post might be inappropriate. Click to display it.
Titus Fortner
2018-08-07 01:49:44 UTC
Permalink
Ok, I see, you're passing in a variable for the color... And by calling
title it isn't waiting for the element to actually be present.
I wish PO made it easier to pass in parameters to element definitions. It's
so straightforward with just Watir syntax.

browser.link(title: "Select Colour: #{color.upcase}").click
That's it.

In PO syntax this should wait for the elements to get show up, then grab
the first one that matches, and then click it:

variation_groups_elements.wait_until(&:present?).find { |el|
el.title.include? color }.click

There might be a more elegant way in PO, but I don't use it so I don't know
it.
Post by NaviHan
The html source is
<ul class="swatches color open row small-up-6 medium-up-6 xxlarge-up-7
columns">
<li class="selectable selected column">
<a class="swatchanchor" href="
https://xxx.com/AU/show-variation/?pid=2003013&amp;originalPid=2003013-05"
title="Select Colour: BLACK" data-attribute-type="color">
<img src=
"/on/demandware.static/Sites-Site/-/default/dw0ba6a777/images/noImgLarge.png"
alt="BLACK">
</a>
</li>
<li class="selectable column">
<a class="swatchanchor" href="
https://ci.cottonon.com/AU/show-variation/?dwvar_2003013_color=2003013-06&amp;pid=2003013&amp;originalPid=2003013-06
" title="Select Colour: EUCALYPTUS" data-attribute-type="color">
<img src=
"/on/demandware.static/Sites-Site/-/default/dw0ba6a777/images/noImgLarge.png"
alt="EUCALYPTUS">
</a>
</li>
<li class="selectable column">
<a class="swatchanchor" href="
https://xxx.com/AU/show-variation/?dwvar_2003013_color=2003013-07&amp;pid=2003013&amp;originalPid=2003013-07
" title="Select Colour: NUDE PINK" data-attribute-type="color">
<img src=
"/on/demandware.static/Sites-Site/-/default/dw0ba6a777/images/noImgLarge.png"
alt="NUDE PINK">
</a>
</li>
The element is defined as
links(:variation_groups, :title => /Select Colour:/)
sleep for 1 section works as below
def select_variation_group(color)
variation_groups_elements.map do |el|
sleep 1
Watir::Wait.until {el}.wait_until_present.click if el.attribute(
'title').include? "#{color}"
end
end
However without sleep fails with trace as below
def select_variation_group(color)
variation_groups_elements.map do |el|
element.wait_until { |el| el.title.include? color }
element.click
end
end
Stacktrace:-
timed out after 10 seconds, waiting for true condition on
located: true; {:title=>/Select Colour:/, :tag_name=>"a", :index=>1}>
(Watir::W
ait::TimeoutError)
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/watir-6.11.0/lib/watir/wait.rb:49:i
n `until'
in `wait_until'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/page-object-2.2.4/lib/page-object/e
lements/element.rb:176:in `wait_until'
C:/git_repo/cog-ui-auto/cuke-tests/features/support/pages/Frontend/Cotton_
On/Pdp_Page.rb:67:in `block in select_variation_group'
C:/git_repo/cog-ui-auto/cuke-tests/features/support/pages/Frontend/Cotton_
On/Pdp_Page.rb:63:in `map'
C:/git_repo/cog-ui-auto/cuke-tests/features/support/pages/Frontend/Cotton_
On/Pdp_Page.rb:63:in `select_variation_group'
C:/git_repo/cog-ui-auto/cuke-tests/features/step_definitions/Pdp_Page_step
s.rb:145:in `block (2 levels) in <top (required)>'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/page-object-2.2.4/lib/page-object/p
age_factory.rb:75:in `on_page'
C:/git_repo/cog-ui-auto/cuke-tests/features/step_definitions/Pdp_Page_step
s.rb:144:in `block in <top (required)>'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/glue/in
voke_in_world.rb:39:in `instance_exec'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/glue/in
voke_in_world.rb:39:in `block in cucumber_instance_exec_in'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/glue/in
voke_in_world.rb:54:in `cucumber_run_with_backtrace_filtering'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/glue/in
voke_in_world.rb:27:in `cucumber_instance_exec_in'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/glue/st
ep_definition.rb:110:in `invoke'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/step_ma
tch.rb:31:in `invoke'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/step_ma
tch.rb:24:in `block in activate'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/test/action.rb:24:in `execute'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/test/step.rb:32:in `execute'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/test/runner.rb:104:in `execute'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/test/runner.rb:51:in `execute'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/test/runner.rb:27:in `test_step'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/test/step.rb:17:in `describe_to'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/test/case.rb:28:in `block (3 levels) in describe_to'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/test/case.rb:27:in `each'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/test/case.rb:27:in `block (2 levels) in describe_to'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/filters
/prepare_world.rb:22:in `block in test_case'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/test/around_hook.rb:17:in `execute'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/test/runner.rb:104:in `execute'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/test/runner.rb:51:in `execute'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/test/runner.rb:34:in `around_hook'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/test/around_hook.rb:12:in `describe_to'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/test/case.rb:120:in `block (2 levels) in compose_around_hooks'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/test/case.rb:121:in `compose_around_hooks'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/test/case.rb:26:in `block in describe_to'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/test/runner.rb:19:in `test_case'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/test/case.rb:25:in `describe_to'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/filters
/prepare_world.rb:11:in `test_case'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/test/case.rb:25:in `describe_to'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/filter.rb:57:in `test_case'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/filters
/retry.rb:18:in `test_case'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/test/case.rb:25:in `describe_to'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/filters
/quit.rb:12:in `test_case'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/test/case.rb:25:in `describe_to'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/filters
/broadcast_test_run_started_event.rb:21:in `block in done'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/filters
/broadcast_test_run_started_event.rb:20:in `map'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/filters
/broadcast_test_run_started_event.rb:20:in `done'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/filter.rb:62:in `done'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/filter.rb:62:in `done'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/filter.rb:62:in `done'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/filter.rb:62:in `done'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/filter.rb:62:in `done'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/test/filters/locations_filter.rb:20:in `done'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/filter.rb:62:in `done'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/test/filters/tag_filter.rb:18:in `done'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/compiler.rb:24:in `done'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re/gherkin/parser.rb:37:in `done'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re.rb:32:in `parse'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-core-3.1.0/lib/cucumber/co
re.rb:21:in `compile'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/runtime
.rb:75:in `run!'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/lib/cucumber/cli/mai
n.rb:34:in `execute!'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/cucumber-3.1.1/bin/cucumber:9:in `<
top (required)>'
C:/Ruby24-x64/bin/cucumber:23:in `load'
C:/Ruby24-x64/bin/cucumber:23:in `<main>'
features/Store_Stock_Finder-AU.feature:155:in `And the user selects
the co
lor "black"'
Post by NaviHan
I have a functionality where I click an a link from an email a voucher
gets added to the shopping cart and a pop up appears with a message. Im
trying to assert the text in the popup
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below
code works 5 out of 10 times.
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in `
rewards_popup_description'
Any stable way to do the job?
--
--
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.
NaviHan
2018-08-07 03:52:02 UTC
Permalink
You are right. It works with pure Watir.
Unfortunately my company insists Pageobejct :-)

With a fresh mind wait_while and wait_until is so confusing
For instance wait_until with present flag will wait until the element is
present and then clicks it and I clearly do not understand why its should
click some other element in this case "loader.bg"

May be I should wait for Justin Ko to help me with this as I use page
object.

I slightly modified the code as

variation_groups_elements.find { |el| el.wait_until(&:present?).title.include? color }.click

This works when it clicks on the first color say "eucalyptus". After that the script does a couple of things and then go to select a different color say black.
Thats when this is failing.

Selenium::WebDriver::Error::UnknownError: unknown error: Element <a class="swatchanchor" href="https://ci.cottonon.com/AU/show-variation/?dwvar_2003013_color=2003013-05&amp;pid=2003013&amp;dwvar_2003013_size=XXS&amp;originalPid=2003013-05" title="Select Colour: BLACK" data-attribute-type="color">...</a> is not clickable at point (504, 64). Other element would receive the click: <div class="loader-bg"></div>
(Session info: chrome=68.0.3440.84)
(Driver info: chromedriver=2.41.578737 (49da6702b16031c40d63e5618de03a32ff6c197e),platform=Windows NT 6.1.7601 SP1 x86_64)

The cucumber script is

And the user navigates to PDP of the product "123"
And the user selects the color "eucalyptus"
And the user selects the online size "XXS"
And the user navigates to In-Store tab
And the user searches for stock in stores by postcode 3030
And the user selects the color "black"

There is a javascript spinner which appears while loading the list of stores for line "And the user searches for stock in stores by postcode 3030"


But as we are using wait_until(&:present) I would expect the script to wait
till the next color is present and then do the click.

Any more thoughts?
Selenium::WebDriver::Error::StaleElementReferenceError: stale element
reference: element is not attached to the page document
(Session info: chrome=68.0.3440.84)
(Driver info: chromedriver=2.36.540470
(e522d04694c7ebea4ba8821272dbef4f9b818c91),platform=Windows NT 6.1.7601 SP1
x86_64)
Post by NaviHan
I have a functionality where I click an a link from an email a voucher
gets added to the shopping cart and a pop up appears with a message. Im
trying to assert the text in the popup
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below
code works 5 out of 10 times.
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in `
rewards_popup_description'
Any stable way to do the job?
--
--
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.
Titus Fortner
2018-08-07 04:29:50 UTC
Permalink
So, it looks like there are a couple things going on here.
wait_until with present flag will wait until the element is present and then clicks it
I think you just misspoke here, but to clarify just in case, `#click`
method will automatically wait for the element it is clicking to be
present based on that element's locator. `#wait_until(&:present?)`
does not automatically click anything

Figuring out if something is "displayed" is very tricky and the
drivers do their best job to approximate it. JavaScript will flummox
them for sure. Is the JavaScript jquery? You can wait for the jquery
queue to be zero. That would be easiest. I think PO gem even has a way
to do that automatically for you. Or you can: `browser.wait_until {
execute_script("return jQuery.active == 0") }`

If it isn't javascript, then it gets difficult because figuring out
these transitionary stages involves a race condition both before and
after the transition. I'm actually curious how other people handle
these with their explicit waits. I petitioned (and it was agreed to)
for the next version of the w3c specification to require an endpoint
to allow us to implement an `#interactible?` method, which we could
then poll for as an explicit wait. In the meantime, I think the best
answer looks like this, but it's a little hacky

def ensure_click(element)
element.click
rescue Selenium::WebDriver::Error::UnknownError => ex
raise unless ex.message.include?("is not clickable")
sleep 0.1
retry
end

As for `StaleElementReferenceError`, update to Watir 6.12. I think we
fixed a bug that caused that to slip through. If you are still seeing
that with 6.12, it's a problem and I'll want to dig into it more. You
should never get that with Watir.
You are right. It works with pure Watir.
Unfortunately my company insists Pageobejct :-)
With a fresh mind wait_while and wait_until is so confusing
For instance wait_until with present flag will wait until the element is present and then clicks it and I clearly do not understand why its should click some other element in this case "loader.bg"
May be I should wait for Justin Ko to help me with this as I use page object.
I slightly modified the code as
variation_groups_elements.find { |el| el.wait_until(&:present?).title.include? color }.click
This works when it clicks on the first color say "eucalyptus". After that the script does a couple of things and then go to select a different color say black.
Thats when this is failing.
Selenium::WebDriver::Error::UnknownError: unknown error: Element <a class="swatchanchor" href="https://ci.cottonon.com/AU/show-variation/?dwvar_2003013_color=2003013-05&amp;pid=2003013&amp;dwvar_2003013_size=XXS&amp;originalPid=2003013-05" title="Select Colour: BLACK" data-attribute-type="color">...</a> is not clickable at point (504, 64). Other element would receive the click: <div class="loader-bg"></div>
(Session info: chrome=68.0.3440.84)
(Driver info: chromedriver=2.41.578737 (49da6702b16031c40d63e5618de03a32ff6c197e),platform=Windows NT 6.1.7601 SP1 x86_64)
The cucumber script is
And the user navigates to PDP of the product "123"
And the user selects the color "eucalyptus"
And the user selects the online size "XXS"
And the user navigates to In-Store tab
And the user searches for stock in stores by postcode 3030
And the user selects the color "black"
There is a javascript spinner which appears while loading the list of stores for line "And the user searches for stock in stores by postcode 3030"
But as we are using wait_until(&:present) I would expect the script to wait till the next color is present and then do the click.
Any more thoughts?
Selenium::WebDriver::Error::StaleElementReferenceError: stale element reference: element is not attached to the page document
(Session info: chrome=68.0.3440.84)
(Driver info: chromedriver=2.36.540470 (e522d04694c7ebea4ba8821272dbef4f9b818c91),platform=Windows NT 6.1.7601 SP1 x86_64)
I have a functionality where I click an a link from an email a voucher gets added to the shopping cart and a pop up appears with a message. Im trying to assert the text in the popup
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below code works 5 out of 10 times.
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in `rewards_popup_description'
Any stable way to do the job?
--
--
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.
http://groups.google.com/group/watir-general
---
You received this message because you are subscribed to the Google Groups "Watir General" group.
For more options, visit https://groups.google.com/d/optout.
--
--
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.
NaviHan
2018-08-07 07:36:59 UTC
Permalink
Yes Titus. I actually meant click after the wait.

The stale element issue is resolved with Watir upgrade.

I used jquery statement and managed to fix the issue. But what is the page object way to do that?

Also could you please clarify the difference between wait.until(&:present?) and wait.while(&:present). I remember you mentioned the first wait for to be truthy and the latter tobefalsey.

When I use both it gives the same results. I check the presence of an element using wait until present and if this evaluates to true do something.

wait while also does the same sometimes.

Is there a good documentation on page object waits. It's really killing me.
--
--
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.
NaviHan
2018-08-07 12:27:15 UTC
Permalink
Hi Titus

I found a good deal of documentation from PageObject wiki so was able to
substitue the waits with PageObject equivalent.
https://github.com/cheezy/page-object/wiki/Ajax-Calls

Still the issue with spinner(Loader.bg) holds and Im working this around
using "Watir::Wait.until(timeout: 30) {@browser.execute_script('return
jQuery.active == 0')}"

Is there any solution in PageObject gem to handle this is still an open
question. Do you reckon I could get some help somewhere?

I would require your help to clear my doubts about "wait while" and "wait
until". I see this is something extensively used in out project but no one
has a clear answer.A grep gave me this

./features/support/pages/Frontend/COG/Checkout_Page.rb: Watir::Wait.while
{order_summ_content_element.visible?}
./features/support/pages/Frontend/COG/Paypal_Page.rb: Watir::Wait.while {
paypal_logo_element.visible?}
./features/support/pages/Frontend/COG/Paypal_Page.rb: Watir::Wait.while {
paypal_spinner_element.visible?}
./features/support/pages/Frontend/COG/Pdp_Page.rb: if Watir::Wait.while {
olapped_sm_window_element.visible?}
./features/support/pages/Frontend/COG/Pdp_Page.rb: # Watir::Wait.while
{stores_elements[9].visible?}
./features/support/pages/Frontend/COG/Pdp_Page.rb: Watir::Wait.while {
stores_elements[9].visible?}
./features/support/pages/Frontend/COG/Thankyou_Page.rb: return Watir::
Wait.while {@browser.text.include?('Did you enjoy your shopping experience
today')}


And Wait.until is used everywhere and the list is huge
./features/support/pages/Frontend/COG/Pdp_Page.rb: #
Watir::Wait.until {check_stores_element}.click
./features/support/pages/Frontend/COG/Pdp_Page.rb: #return
Watir::Wait.until {el}.parent(:index => 1).attribute('class') if
el.text.include? "#{size}"
./features/support/pages/Frontend/COG/Pdp_Page.rb: #return
Watir::Wait.until {el}.parent.attribute('class') if
el.span_element.text.include? "#{size}"
./features/support/pages/Frontend/COG/Pdp_Page.rb: #return
Watir::Wait.until {search_string_element}.attribute('value')
./features/support/pages/Frontend/COG/Pdp_Page.rb: #return
Watir::Wait.until {search_string_element}.attribute('value')
./features/support/pages/Frontend/COG/Pdp_Page.rb: @succ_txt = Watir
::Wait.until {pdp_success_msg_block_element}.text
./features/support/pages/Frontend/COG/Pdp_Page.rb: Watir::Wait.until(
timeout: 30){add_to_bag_element.enabled?}
./features/support/pages/Frontend/COG/Search_Page.rb: Watir::Wait.
until {search_field_element}.when_present.clear
./features/support/pages/Frontend/COG/Search_Page.rb: Watir::Wait.
until {search_field_element}.when_present.click
./features/support/pages/Frontend/COG/Search_Page.rb: Watir::Wait.
until {search_field_element}.when_present.set(arg)

I dont get any idea out of this..
--
--
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.
Justin Ko
2018-08-07 14:28:38 UTC
Permalink
Hi Navi,

Just to be clear, are you saying that "Watir::Wait.until(timeout: 30) {
@browser.execute_script('return jQuery.active == 0')}" solves the timing
issue? You are just asking if there is a Page Object way to avoid doing
this manually everywhere?

Thanks,
Justin
Post by NaviHan
Hi Titus
I found a good deal of documentation from PageObject wiki so was able to
substitue the waits with PageObject equivalent.
https://github.com/cheezy/page-object/wiki/Ajax-Calls
Still the issue with spinner(Loader.bg) holds and Im working this around
jQuery.active == 0')}"
Is there any solution in PageObject gem to handle this is still an open
question. Do you reckon I could get some help somewhere?
I would require your help to clear my doubts about "wait while" and "wait
until". I see this is something extensively used in out project but no one
has a clear answer.A grep gave me this
./features/support/pages/Frontend/COG/Checkout_Page.rb: Watir::Wait.
while {order_summ_content_element.visible?}
./features/support/pages/Frontend/COG/Paypal_Page.rb: Watir::Wait.while
{paypal_logo_element.visible?}
./features/support/pages/Frontend/COG/Paypal_Page.rb: Watir::Wait.while
{paypal_spinner_element.visible?}
./features/support/pages/Frontend/COG/Pdp_Page.rb: if Watir::Wait.while
{olapped_sm_window_element.visible?}
./features/support/pages/Frontend/COG/Pdp_Page.rb: # Watir::Wait.while
{stores_elements[9].visible?}
./features/support/pages/Frontend/COG/Pdp_Page.rb: Watir::Wait.while {
stores_elements[9].visible?}
experience today')}
And Wait.until is used everywhere and the list is huge
./features/support/pages/Frontend/COG/Pdp_Page.rb: #
Watir::Wait.until {check_stores_element}.click
./features/support/pages/Frontend/COG/Pdp_Page.rb: #return
Watir::Wait.until {el}.parent(:index => 1).attribute('class') if
el.text.include? "#{size}"
./features/support/pages/Frontend/COG/Pdp_Page.rb: #return
Watir::Wait.until {el}.parent.attribute('class') if
el.span_element.text.include? "#{size}"
./features/support/pages/Frontend/COG/Pdp_Page.rb: #return
Watir::Wait.until {search_string_element}.attribute('value')
./features/support/pages/Frontend/COG/Pdp_Page.rb: #return
Watir::Wait.until {search_string_element}.attribute('value')
Watir::Wait.until {pdp_success_msg_block_element}.text
./features/support/pages/Frontend/COG/Pdp_Page.rb: Watir::Wait.
until(timeout: 30){add_to_bag_element.enabled?}
./features/support/pages/Frontend/COG/Search_Page.rb: Watir::Wait.
until {search_field_element}.when_present.clear
./features/support/pages/Frontend/COG/Search_Page.rb: Watir::Wait.
until {search_field_element}.when_present.click
./features/support/pages/Frontend/COG/Search_Page.rb: Watir::Wait.
until {search_field_element}.when_present.set(arg)
I dont get any idea out of this..
--
--
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.
NaviHan
2018-08-07 14:43:36 UTC
Permalink
Yes Justin, That was exactly what happened. I ran the script a few times
and using "Watir::Wait.until(timeout: 30) {@browser.execute_script('return
jQuery.active == 0')}" never gave me the error "

Element <span class="swatchanchor-value">...</span> *is not clickable* at
point (537, 362). Other element would receive the click: <div class=
*"loader-bg">*</div>"


The code is

def select_online_size (size)
Watir::Wait.until(timeout: 30) {@browser.execute_script('return jQuery.active == 0')}
sizes_online_elements.find {|el| el.when_present.text.eql? size}.click
end

I was expecting that the "when_present" method would not give any timing
issue because this waits until the element is present. Somehow this
evaulates to true at the same time the spinner which is loading while the
Ajax is running receives the click.


Is there a PO way to resolve this , I mean without having to use the
"jQuery" statement


Cheers

Navi
Post by NaviHan
I have a functionality where I click an a link from an email a voucher
gets added to the shopping cart and a pop up appears with a message. Im
trying to assert the text in the popup
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below
code works 5 out of 10 times.
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in `
rewards_popup_description'
Any stable way to do the job?
--
--
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.
Titus Fortner
2018-08-07 15:36:37 UTC
Permalink
Found it

See the section on Waiting for AJAX Calls here:
http://cheezyworld.com/2012/02/23/page-object-0-6-2-released/
let's you call `wait_for_ajax` where you want it.
Element <span class="swatchanchor-value">...</span> is not clickable at point (537, 362). Other element would receive the click: <div class="loader-bg"></div>"
The code is
def select_online_size (size)
sizes_online_elements.find {|el| el.when_present.text.eql? size}.click
end
I was expecting that the "when_present" method would not give any timing issue because this waits until the element is present. Somehow this evaulates to true at the same time the spinner which is loading while the Ajax is running receives the click.
Is there a PO way to resolve this , I mean without having to use the "jQuery" statement
Cheers
Navi
I have a functionality where I click an a link from an email a voucher gets added to the shopping cart and a pop up appears with a message. Im trying to assert the text in the popup
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below code works 5 out of 10 times.
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in `rewards_popup_description'
Any stable way to do the job?
--
--
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.
http://groups.google.com/group/watir-general
---
You received this message because you are subscribed to the Google Groups "Watir General" group.
For more options, visit https://groups.google.com/d/optout.
--
--
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.
Justin Ko
2018-08-07 16:07:42 UTC
Permalink
The #wait_for_ajax simplifies things if you need to manually call it.
However, it sounds like you would have to sprinkle this everywhere.

I would suggest adding the jQuery.active check to your browser's
after_hooks. Ideally this would catch all (or at least most) of the
problems.

Note that there would be a small performance hit of making this check after
each click/goto. However, if it's an AJAX heavy application, it's probably
worth it.

Justin
Post by Titus Fortner
Found it
http://cheezyworld.com/2012/02/23/page-object-0-6-2-released/
let's you call `wait_for_ajax` where you want it.
Post by NaviHan
Yes Justin, That was exactly what happened. I ran the script a few times
jQuery.active == 0')}" never gave me the error "
Post by NaviHan
Element <span class="swatchanchor-value">...</span> is not clickable at
point (537, 362). Other element would receive the click: <div
class="loader-bg"></div>"
Post by NaviHan
The code is
def select_online_size (size)
jQuery.active == 0')}
Post by NaviHan
sizes_online_elements.find {|el| el.when_present.text.eql? size}.click
end
I was expecting that the "when_present" method would not give any timing
issue because this waits until the element is present. Somehow this
evaulates to true at the same time the spinner which is loading while the
Ajax is running receives the click.
Post by NaviHan
Is there a PO way to resolve this , I mean without having to use the
"jQuery" statement
Post by NaviHan
Cheers
Navi
Post by NaviHan
I have a functionality where I click an a link from an email a voucher
gets added to the shopping cart and a pop up appears with a message. Im
trying to assert the text in the popup
Post by NaviHan
Post by NaviHan
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below
code works 5 out of 10 times.
Post by NaviHan
Post by NaviHan
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
error
Post by NaviHan
Post by NaviHan
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in
`rewards_popup_description'
Post by NaviHan
Post by NaviHan
Any stable way to do the job?
--
--
Before posting, please read
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
Post by NaviHan
In short: search before you ask, be nice.
http://groups.google.com/group/watir-general
---
You received this message because you are subscribed to the Google
Groups "Watir General" group.
Post by NaviHan
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
--
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.
r***@gmail.com
2018-08-07 16:17:32 UTC
Permalink
Hi Justin,

We are also using this wait_for_ajax in one of our Project. You said

I would suggest adding the jQuery.active check to your browser's
Post by Justin Ko
after_hooks. Ideally this would catch all (or at least most) of the
problems.
May I know how to do this?
Post by Justin Ko
The #wait_for_ajax simplifies things if you need to manually call it.
However, it sounds like you would have to sprinkle this everywhere.
Note that there would be a small performance hit of making this check
after each click/goto. However, if it's an AJAX heavy application, it's
probably worth it.
Justin
Post by Titus Fortner
Found it
http://cheezyworld.com/2012/02/23/page-object-0-6-2-released/
let's you call `wait_for_ajax` where you want it.
Post by NaviHan
Yes Justin, That was exactly what happened. I ran the script a few
times and using "Watir::Wait.until(timeout: 30)
error "
Post by NaviHan
Element <span class="swatchanchor-value">...</span> is not clickable at
point (537, 362). Other element would receive the click: <div
class="loader-bg"></div>"
Post by NaviHan
The code is
def select_online_size (size)
jQuery.active == 0')}
Post by NaviHan
sizes_online_elements.find {|el| el.when_present.text.eql?
size}.click
Post by NaviHan
end
I was expecting that the "when_present" method would not give any
timing issue because this waits until the element is present. Somehow this
evaulates to true at the same time the spinner which is loading while the
Ajax is running receives the click.
Post by NaviHan
Is there a PO way to resolve this , I mean without having to use the
"jQuery" statement
Post by NaviHan
Cheers
Navi
Post by NaviHan
I have a functionality where I click an a link from an email a voucher
gets added to the shopping cart and a pop up appears with a message. Im
trying to assert the text in the popup
Post by NaviHan
Post by NaviHan
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below
code works 5 out of 10 times.
Post by NaviHan
Post by NaviHan
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
error
Post by NaviHan
Post by NaviHan
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in
`rewards_popup_description'
Post by NaviHan
Post by NaviHan
Any stable way to do the job?
--
--
Before posting, please read
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
Post by NaviHan
In short: search before you ask, be nice.
http://groups.google.com/group/watir-general
---
You received this message because you are subscribed to the Google
Groups "Watir General" group.
Post by NaviHan
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
--
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.
Titus Fortner
2018-08-07 16:24:16 UTC
Permalink
jquery_wait = lambda { |br| br.wait_until { |b| b.execute_script('return
jQuery.active == 0') } } browser.after_hooks.add(jquery_wait)
Post by r***@gmail.com
Hi Justin,
We are also using this wait_for_ajax in one of our Project. You said
I would suggest adding the jQuery.active check to your browser's
Post by Justin Ko
after_hooks. Ideally this would catch all (or at least most) of the
problems.
May I know how to do this?
Post by Justin Ko
The #wait_for_ajax simplifies things if you need to manually call it.
However, it sounds like you would have to sprinkle this everywhere.
Note that there would be a small performance hit of making this check
after each click/goto. However, if it's an AJAX heavy application, it's
probably worth it.
Justin
Post by Titus Fortner
Found it
http://cheezyworld.com/2012/02/23/page-object-0-6-2-released/
let's you call `wait_for_ajax` where you want it.
Post by NaviHan
Yes Justin, That was exactly what happened. I ran the script a few
times and using "Watir::Wait.until(timeout: 30)
error "
Post by NaviHan
Element <span class="swatchanchor-value">...</span> is not clickable
at point (537, 362). Other element would receive the click: <div
class="loader-bg"></div>"
Post by NaviHan
The code is
def select_online_size (size)
jQuery.active == 0')}
Post by NaviHan
sizes_online_elements.find {|el| el.when_present.text.eql?
size}.click
Post by NaviHan
end
I was expecting that the "when_present" method would not give any
timing issue because this waits until the element is present. Somehow this
evaulates to true at the same time the spinner which is loading while the
Ajax is running receives the click.
Post by NaviHan
Is there a PO way to resolve this , I mean without having to use the
"jQuery" statement
Post by NaviHan
Cheers
Navi
Post by NaviHan
I have a functionality where I click an a link from an email a
voucher gets added to the shopping cart and a pop up appears with a
message. Im trying to assert the text in the popup
Post by NaviHan
Post by NaviHan
I have defined the element as
div(:cta_description, :css =>
'.homepage-clicktoactiavte-description')
Post by NaviHan
Post by NaviHan
Tried to use a mix of Watir and Pageobejct to read the text. The
below code works 5 out of 10 times.
Post by NaviHan
Post by NaviHan
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
error
Post by NaviHan
Post by NaviHan
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in
`rewards_popup_description'
Post by NaviHan
Post by NaviHan
Any stable way to do the job?
--
--
Before posting, please read
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
Post by NaviHan
In short: search before you ask, be nice.
http://groups.google.com/group/watir-general
---
You received this message because you are subscribed to the Google
Groups "Watir General" group.
Post by NaviHan
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
--
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.
r***@gmail.com
2018-08-07 16:27:00 UTC
Permalink
Ah! that's pretty interesting, I was not knowing this. So you say Once I
have written this code, this code will be executed after every click I do?
Post by Titus Fortner
jquery_wait = lambda { |br| br.wait_until { |b| b.execute_script('return
jQuery.active == 0') } } browser.after_hooks.add(jquery_wait)
Post by r***@gmail.com
Hi Justin,
We are also using this wait_for_ajax in one of our Project. You said
I would suggest adding the jQuery.active check to your browser's
Post by Justin Ko
after_hooks. Ideally this would catch all (or at least most) of the
problems.
May I know how to do this?
Post by Justin Ko
The #wait_for_ajax simplifies things if you need to manually call it.
However, it sounds like you would have to sprinkle this everywhere.
Note that there would be a small performance hit of making this check
after each click/goto. However, if it's an AJAX heavy application, it's
probably worth it.
Justin
Post by Titus Fortner
Found it
http://cheezyworld.com/2012/02/23/page-object-0-6-2-released/
let's you call `wait_for_ajax` where you want it.
Post by NaviHan
Yes Justin, That was exactly what happened. I ran the script a few
times and using "Watir::Wait.until(timeout: 30)
error "
Post by NaviHan
Element <span class="swatchanchor-value">...</span> is not clickable
at point (537, 362). Other element would receive the click: <div
class="loader-bg"></div>"
Post by NaviHan
The code is
def select_online_size (size)
jQuery.active == 0')}
Post by NaviHan
sizes_online_elements.find {|el| el.when_present.text.eql?
size}.click
Post by NaviHan
end
I was expecting that the "when_present" method would not give any
timing issue because this waits until the element is present. Somehow this
evaulates to true at the same time the spinner which is loading while the
Ajax is running receives the click.
Post by NaviHan
Is there a PO way to resolve this , I mean without having to use the
"jQuery" statement
Post by NaviHan
Cheers
Navi
Post by NaviHan
I have a functionality where I click an a link from an email a
voucher gets added to the shopping cart and a pop up appears with a
message. Im trying to assert the text in the popup
Post by NaviHan
Post by NaviHan
I have defined the element as
div(:cta_description, :css =>
'.homepage-clicktoactiavte-description')
Post by NaviHan
Post by NaviHan
Tried to use a mix of Watir and Pageobejct to read the text. The
below code works 5 out of 10 times.
Post by NaviHan
Post by NaviHan
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
error
Post by NaviHan
Post by NaviHan
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in
`rewards_popup_description'
Post by NaviHan
Post by NaviHan
Any stable way to do the job?
--
--
Before posting, please read
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
Post by NaviHan
In short: search before you ask, be nice.
http://groups.google.com/group/watir-general
---
You received this message because you are subscribed to the Google
Groups "Watir General" group.
Post by NaviHan
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
--
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.
Titus Fortner
2018-08-07 16:29:33 UTC
Permalink
after any action that changes or is likely to change the dom, so it can get
heavy if overused. The Executor class when implemented will open up a lot
more flexibility.
Post by r***@gmail.com
Ah! that's pretty interesting, I was not knowing this. So you say Once I
have written this code, this code will be executed after every click I do?
Post by Titus Fortner
jquery_wait = lambda { |br| br.wait_until { |b| b.execute_script('return
jQuery.active == 0') } } browser.after_hooks.add(jquery_wait)
Post by r***@gmail.com
Hi Justin,
We are also using this wait_for_ajax in one of our Project. You said
I would suggest adding the jQuery.active check to your browser's
Post by Justin Ko
after_hooks. Ideally this would catch all (or at least most) of the
problems.
May I know how to do this?
Post by Justin Ko
The #wait_for_ajax simplifies things if you need to manually call it.
However, it sounds like you would have to sprinkle this everywhere.
Note that there would be a small performance hit of making this check
after each click/goto. However, if it's an AJAX heavy application, it's
probably worth it.
Justin
Post by Titus Fortner
Found it
http://cheezyworld.com/2012/02/23/page-object-0-6-2-released/
let's you call `wait_for_ajax` where you want it.
Post by NaviHan
Yes Justin, That was exactly what happened. I ran the script a few
times and using "Watir::Wait.until(timeout: 30)
error "
Post by NaviHan
Element <span class="swatchanchor-value">...</span> is not clickable
at point (537, 362). Other element would receive the click: <div
class="loader-bg"></div>"
Post by NaviHan
The code is
def select_online_size (size)
jQuery.active == 0')}
Post by NaviHan
sizes_online_elements.find {|el| el.when_present.text.eql?
size}.click
Post by NaviHan
end
I was expecting that the "when_present" method would not give any
timing issue because this waits until the element is present. Somehow this
evaulates to true at the same time the spinner which is loading while the
Ajax is running receives the click.
Post by NaviHan
Is there a PO way to resolve this , I mean without having to use the
"jQuery" statement
Post by NaviHan
Cheers
Navi
Post by NaviHan
I have a functionality where I click an a link from an email a
voucher gets added to the shopping cart and a pop up appears with a
message. Im trying to assert the text in the popup
Post by NaviHan
Post by NaviHan
I have defined the element as
div(:cta_description, :css =>
'.homepage-clicktoactiavte-description')
Post by NaviHan
Post by NaviHan
Tried to use a mix of Watir and Pageobejct to read the text. The
below code works 5 out of 10 times.
Post by NaviHan
Post by NaviHan
@rewards_popup_txt =
Watir::Wait.until{cta_description_element}.text
Post by NaviHan
Post by NaviHan
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
error
Post by NaviHan
Post by NaviHan
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in
`rewards_popup_description'
Post by NaviHan
Post by NaviHan
Any stable way to do the job?
--
--
Before posting, please read
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
Post by NaviHan
In short: search before you ask, be nice.
http://groups.google.com/group/watir-general
---
You received this message because you are subscribed to the Google
Groups "Watir General" group.
Post by NaviHan
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
r***@gmail.com
2018-08-07 16:37:58 UTC
Permalink
That will be interesting, I am using as shown below,
def selectAndWait(locator, value)
select locator, value
waitForPageLoad
end
def waitForPageLoad
@b.wait_until(timeout: @Page_Load) {@b.execute_script("return (jQuery.active === 0)").eql? true}
end
Let me try using this `after_hook`, a very interesting idea indeed.
after any action that changes or is likely to change the dom, so it can
get heavy if overused. The Executor class when implemented will open up a
lot more flexibility.
Post by r***@gmail.com
Ah! that's pretty interesting, I was not knowing this. So you say Once I
have written this code, this code will be executed after every click I do?
Post by Titus Fortner
jquery_wait = lambda { |br| br.wait_until { |b| b.execute_script('return
jQuery.active == 0') } } browser.after_hooks.add(jquery_wait)
Post by r***@gmail.com
Hi Justin,
We are also using this wait_for_ajax in one of our Project. You said
I would suggest adding the jQuery.active check to your browser's
Post by Justin Ko
after_hooks. Ideally this would catch all (or at least most) of the
problems.
May I know how to do this?
Post by Justin Ko
The #wait_for_ajax simplifies things if you need to manually call it.
However, it sounds like you would have to sprinkle this everywhere.
Note that there would be a small performance hit of making this check
after each click/goto. However, if it's an AJAX heavy application, it's
probably worth it.
Justin
Post by Titus Fortner
Found it
http://cheezyworld.com/2012/02/23/page-object-0-6-2-released/
let's you call `wait_for_ajax` where you want it.
Post by NaviHan
Yes Justin, That was exactly what happened. I ran the script a few
times and using "Watir::Wait.until(timeout: 30)
error "
Post by NaviHan
Element <span class="swatchanchor-value">...</span> is not
clickable at point (537, 362). Other element would receive the click: <div
class="loader-bg"></div>"
Post by NaviHan
The code is
def select_online_size (size)
jQuery.active == 0')}
Post by NaviHan
sizes_online_elements.find {|el| el.when_present.text.eql?
size}.click
Post by NaviHan
end
I was expecting that the "when_present" method would not give any
timing issue because this waits until the element is present. Somehow this
evaulates to true at the same time the spinner which is loading while the
Ajax is running receives the click.
Post by NaviHan
Is there a PO way to resolve this , I mean without having to use
the "jQuery" statement
Post by NaviHan
Cheers
Navi
Post by NaviHan
I have a functionality where I click an a link from an email a
voucher gets added to the shopping cart and a pop up appears with a
message. Im trying to assert the text in the popup
Post by NaviHan
Post by NaviHan
I have defined the element as
div(:cta_description, :css =>
'.homepage-clicktoactiavte-description')
Post by NaviHan
Post by NaviHan
Tried to use a mix of Watir and Pageobejct to read the text. The
below code works 5 out of 10 times.
Post by NaviHan
Post by NaviHan
@rewards_popup_txt =
Watir::Wait.until{cta_description_element}.text
Post by NaviHan
Post by NaviHan
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/,"
")
error
Post by NaviHan
Post by NaviHan
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/,"
")
Post by NaviHan
Post by NaviHan
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in
`rewards_popup_description'
Post by NaviHan
Post by NaviHan
Any stable way to do the job?
--
--
Before posting, please read
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
Post by NaviHan
In short: search before you ask, be nice.
http://groups.google.com/group/watir-general
---
You received this message because you are subscribed to the Google
Groups "Watir General" group.
Post by NaviHan
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
Titus Fortner
2018-08-07 16:48:34 UTC
Permalink
No, your way is better if it is working for you. Adding it to the after
hook will add a ton more unnecessary calls to your code.
Post by r***@gmail.com
That will be interesting, I am using as shown below,
def selectAndWait(locator, value)
select locator, value
waitForPageLoad
end
def waitForPageLoad
@b.wait_until(timeout: @Page_Load) {@b.execute_script("return (jQuery.active === 0)").eql? true}
end
Let me try using this `after_hook`, a very interesting idea indeed.
after any action that changes or is likely to change the dom, so it can
get heavy if overused. The Executor class when implemented will open up a
lot more flexibility.
Post by r***@gmail.com
Ah! that's pretty interesting, I was not knowing this. So you say Once I
have written this code, this code will be executed after every click I do?
Post by Titus Fortner
jquery_wait = lambda { |br| br.wait_until { |b|
b.execute_script('return jQuery.active == 0') } }
browser.after_hooks.add(jquery_wait)
Post by r***@gmail.com
Hi Justin,
We are also using this wait_for_ajax in one of our Project. You said
I would suggest adding the jQuery.active check to your browser's
Post by Justin Ko
after_hooks. Ideally this would catch all (or at least most) of the
problems.
May I know how to do this?
Post by Justin Ko
The #wait_for_ajax simplifies things if you need to manually call it.
However, it sounds like you would have to sprinkle this everywhere.
Note that there would be a small performance hit of making this check
after each click/goto. However, if it's an AJAX heavy application, it's
probably worth it.
Justin
Post by Titus Fortner
Found it
http://cheezyworld.com/2012/02/23/page-object-0-6-2-released/
let's you call `wait_for_ajax` where you want it.
Post by NaviHan
Yes Justin, That was exactly what happened. I ran the script a few
times and using "Watir::Wait.until(timeout: 30)
error "
Post by NaviHan
Element <span class="swatchanchor-value">...</span> is not
clickable at point (537, 362). Other element would receive the click: <div
class="loader-bg"></div>"
Post by NaviHan
The code is
def select_online_size (size)
jQuery.active == 0')}
Post by NaviHan
sizes_online_elements.find {|el| el.when_present.text.eql?
size}.click
Post by NaviHan
end
I was expecting that the "when_present" method would not give any
timing issue because this waits until the element is present. Somehow this
evaulates to true at the same time the spinner which is loading while the
Ajax is running receives the click.
Post by NaviHan
Is there a PO way to resolve this , I mean without having to use
the "jQuery" statement
Post by NaviHan
Cheers
Navi
Post by NaviHan
I have a functionality where I click an a link from an email a
voucher gets added to the shopping cart and a pop up appears with a
message. Im trying to assert the text in the popup
Post by NaviHan
Post by NaviHan
I have defined the element as
div(:cta_description, :css =>
'.homepage-clicktoactiavte-description')
Post by NaviHan
Post by NaviHan
Tried to use a mix of Watir and Pageobejct to read the text. The
below code works 5 out of 10 times.
Post by NaviHan
Post by NaviHan
@rewards_popup_txt =
Watir::Wait.until{cta_description_element}.text
Post by NaviHan
Post by NaviHan
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/,"
")
shows error
Post by NaviHan
Post by NaviHan
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/,"
")
Post by NaviHan
Post by NaviHan
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in
`rewards_popup_description'
Post by NaviHan
Post by NaviHan
Any stable way to do the job?
--
--
Before posting, please read
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
Post by NaviHan
In short: search before you ask, be nice.
http://groups.google.com/group/watir-general
---
You received this message because you are subscribed to the Google
Groups "Watir General" group.
Post by NaviHan
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
r***@gmail.com
2018-08-07 16:53:06 UTC
Permalink
Oh okay. But you said

The Executor class when implemented will open up a lot more flexibility.


So will it be lesser wire call after Executor class implemented? Can I add
after that?
Post by Titus Fortner
No, your way is better if it is working for you. Adding it to the after
hook will add a ton more unnecessary calls to your code.
Post by r***@gmail.com
That will be interesting, I am using as shown below,
def selectAndWait(locator, value)
select locator, value
waitForPageLoad
end
def waitForPageLoad
@b.wait_until(timeout: @Page_Load) {@b.execute_script("return (jQuery.active === 0)").eql? true}
end
Let me try using this `after_hook`, a very interesting idea indeed.
after any action that changes or is likely to change the dom, so it can
get heavy if overused. The Executor class when implemented will open up a
lot more flexibility.
Post by r***@gmail.com
Ah! that's pretty interesting, I was not knowing this. So you say Once
I have written this code, this code will be executed after every click I
do?
Post by Titus Fortner
jquery_wait = lambda { |br| br.wait_until { |b|
b.execute_script('return jQuery.active == 0') } }
browser.after_hooks.add(jquery_wait)
Post by r***@gmail.com
Hi Justin,
We are also using this wait_for_ajax in one of our Project. You said
I would suggest adding the jQuery.active check to your browser's
Post by Justin Ko
after_hooks. Ideally this would catch all (or at least most) of the
problems.
May I know how to do this?
Post by Justin Ko
The #wait_for_ajax simplifies things if you need to manually call
it. However, it sounds like you would have to sprinkle this everywhere.
Note that there would be a small performance hit of making this
check after each click/goto. However, if it's an AJAX heavy application,
it's probably worth it.
Justin
Post by Titus Fortner
Found it
http://cheezyworld.com/2012/02/23/page-object-0-6-2-released/
let's you call `wait_for_ajax` where you want it.
Post by NaviHan
Yes Justin, That was exactly what happened. I ran the script a
few times and using "Watir::Wait.until(timeout: 30)
error "
Post by NaviHan
Element <span class="swatchanchor-value">...</span> is not
clickable at point (537, 362). Other element would receive the click: <div
class="loader-bg"></div>"
Post by NaviHan
The code is
def select_online_size (size)
jQuery.active == 0')}
Post by NaviHan
sizes_online_elements.find {|el| el.when_present.text.eql?
size}.click
Post by NaviHan
end
I was expecting that the "when_present" method would not give any
timing issue because this waits until the element is present. Somehow this
evaulates to true at the same time the spinner which is loading while the
Ajax is running receives the click.
Post by NaviHan
Is there a PO way to resolve this , I mean without having to use
the "jQuery" statement
Post by NaviHan
Cheers
Navi
Post by NaviHan
I have a functionality where I click an a link from an email a
voucher gets added to the shopping cart and a pop up appears with a
message. Im trying to assert the text in the popup
Post by NaviHan
Post by NaviHan
I have defined the element as
div(:cta_description, :css =>
'.homepage-clicktoactiavte-description')
Post by NaviHan
Post by NaviHan
Tried to use a mix of Watir and Pageobejct to read the text. The
below code works 5 out of 10 times.
Post by NaviHan
Post by NaviHan
@rewards_popup_txt =
Watir::Wait.until{cta_description_element}.text
Post by NaviHan
Post by NaviHan
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/,"
")
shows error
Post by NaviHan
Post by NaviHan
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/,"
")
Post by NaviHan
Post by NaviHan
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in
`rewards_popup_description'
Post by NaviHan
Post by NaviHan
Any stable way to do the job?
--
--
Before posting, please read
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
Post by NaviHan
In short: search before you ask, be nice.
http://groups.google.com/group/watir-general
---
You received this message because you are subscribed to the
Google Groups "Watir General" group.
Post by NaviHan
To unsubscribe from this group and stop receiving emails from it,
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
Titus Fortner
2018-08-07 16:54:39 UTC
Permalink
you'll be able to specify the exact desired behaviours in a more granular
way
Post by r***@gmail.com
Oh okay. But you said
The Executor class when implemented will open up a lot more flexibility.
So will it be lesser wire call after Executor class implemented? Can I add
after that?
Post by Titus Fortner
No, your way is better if it is working for you. Adding it to the after
hook will add a ton more unnecessary calls to your code.
Post by r***@gmail.com
That will be interesting, I am using as shown below,
def selectAndWait(locator, value)
select locator, value
waitForPageLoad
end
def waitForPageLoad
@b.wait_until(timeout: @Page_Load) {@b.execute_script("return (jQuery.active === 0)").eql? true}
end
Let me try using this `after_hook`, a very interesting idea indeed.
after any action that changes or is likely to change the dom, so it can
get heavy if overused. The Executor class when implemented will open up a
lot more flexibility.
Post by r***@gmail.com
Ah! that's pretty interesting, I was not knowing this. So you say Once
I have written this code, this code will be executed after every click I
do?
Post by Titus Fortner
jquery_wait = lambda { |br| br.wait_until { |b|
b.execute_script('return jQuery.active == 0') } }
browser.after_hooks.add(jquery_wait)
On Tuesday, August 7, 2018 at 9:17:32 AM UTC-7,
Post by r***@gmail.com
Hi Justin,
We are also using this wait_for_ajax in one of our Project. You said
I would suggest adding the jQuery.active check to your browser's
Post by Justin Ko
after_hooks. Ideally this would catch all (or at least most) of the
problems.
May I know how to do this?
Post by Justin Ko
The #wait_for_ajax simplifies things if you need to manually call
it. However, it sounds like you would have to sprinkle this everywhere.
Note that there would be a small performance hit of making this
check after each click/goto. However, if it's an AJAX heavy application,
it's probably worth it.
Justin
Post by Titus Fortner
Found it
http://cheezyworld.com/2012/02/23/page-object-0-6-2-released/
let's you call `wait_for_ajax` where you want it.
Post by NaviHan
Yes Justin, That was exactly what happened. I ran the script a
few times and using "Watir::Wait.until(timeout: 30)
error "
Post by NaviHan
Element <span class="swatchanchor-value">...</span> is not
clickable at point (537, 362). Other element would receive the click: <div
class="loader-bg"></div>"
Post by NaviHan
The code is
def select_online_size (size)
Watir::Wait.until(timeout: 30)
sizes_online_elements.find {|el| el.when_present.text.eql?
size}.click
Post by NaviHan
end
I was expecting that the "when_present" method would not give
any timing issue because this waits until the element is present. Somehow
this evaulates to true at the same time the spinner which is loading while
the Ajax is running receives the click.
Post by NaviHan
Is there a PO way to resolve this , I mean without having to use
the "jQuery" statement
Post by NaviHan
Cheers
Navi
Post by NaviHan
I have a functionality where I click an a link from an email a
voucher gets added to the shopping cart and a pop up appears with a
message. Im trying to assert the text in the popup
Post by NaviHan
Post by NaviHan
I have defined the element as
div(:cta_description, :css =>
'.homepage-clicktoactiavte-description')
Post by NaviHan
Post by NaviHan
Tried to use a mix of Watir and Pageobejct to read the text.
The below code works 5 out of 10 times.
Post by NaviHan
Post by NaviHan
@rewards_popup_txt =
Watir::Wait.until{cta_description_element}.text
Post by NaviHan
Post by NaviHan
@rewards_popup_txt =
@rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
shows error
Post by NaviHan
Post by NaviHan
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt =
@rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Post by NaviHan
Post by NaviHan
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in
`rewards_popup_description'
Post by NaviHan
Post by NaviHan
Any stable way to do the job?
--
--
Before posting, please read
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
Post by NaviHan
In short: search before you ask, be nice.
http://groups.google.com/group/watir-general
---
You received this message because you are subscribed to the
Google Groups "Watir General" group.
Post by NaviHan
To unsubscribe from this group and stop receiving emails from
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
r***@gmail.com
2018-08-07 17:00:37 UTC
Permalink
Okay, I will be waiting for that then! There was a new project in my
company for which I convinced them to use WATIR instead of Selenium where I
had to implement this waiting behavior! Okay excited to see this new
feature to be added! Thanks.
Post by Titus Fortner
you'll be able to specify the exact desired behaviours in a more granular
way
Post by r***@gmail.com
Oh okay. But you said
The Executor class when implemented will open up a lot more flexibility.
So will it be lesser wire call after Executor class implemented? Can I
add after that?
Post by Titus Fortner
No, your way is better if it is working for you. Adding it to the after
hook will add a ton more unnecessary calls to your code.
Post by r***@gmail.com
That will be interesting, I am using as shown below,
def selectAndWait(locator, value)
select locator, value
waitForPageLoad
end
def waitForPageLoad
@b.wait_until(timeout: @Page_Load) {@b.execute_script("return (jQuery.active === 0)").eql? true}
end
Let me try using this `after_hook`, a very interesting idea indeed.
after any action that changes or is likely to change the dom, so it
can get heavy if overused. The Executor class when implemented will open up
a lot more flexibility.
Post by r***@gmail.com
Ah! that's pretty interesting, I was not knowing this. So you say
Once I have written this code, this code will be executed after every click
I do?
Post by Titus Fortner
jquery_wait = lambda { |br| br.wait_until { |b|
b.execute_script('return jQuery.active == 0') } }
browser.after_hooks.add(jquery_wait)
On Tuesday, August 7, 2018 at 9:17:32 AM UTC-7,
Post by r***@gmail.com
Hi Justin,
We are also using this wait_for_ajax in one of our Project. You said
I would suggest adding the jQuery.active check to your browser's
Post by Justin Ko
after_hooks. Ideally this would catch all (or at least most) of the
problems.
May I know how to do this?
Post by Justin Ko
The #wait_for_ajax simplifies things if you need to manually call
it. However, it sounds like you would have to sprinkle this everywhere.
Note that there would be a small performance hit of making this
check after each click/goto. However, if it's an AJAX heavy application,
it's probably worth it.
Justin
Post by Titus Fortner
Found it
http://cheezyworld.com/2012/02/23/page-object-0-6-2-released/
let's you call `wait_for_ajax` where you want it.
Post by NaviHan
Yes Justin, That was exactly what happened. I ran the script a
few times and using "Watir::Wait.until(timeout: 30)
error "
Post by NaviHan
Element <span class="swatchanchor-value">...</span> is not
clickable at point (537, 362). Other element would receive the click: <div
class="loader-bg"></div>"
Post by NaviHan
The code is
def select_online_size (size)
Watir::Wait.until(timeout: 30)
sizes_online_elements.find {|el| el.when_present.text.eql?
size}.click
Post by NaviHan
end
I was expecting that the "when_present" method would not give
any timing issue because this waits until the element is present. Somehow
this evaulates to true at the same time the spinner which is loading while
the Ajax is running receives the click.
Post by NaviHan
Is there a PO way to resolve this , I mean without having to
use the "jQuery" statement
Post by NaviHan
Cheers
Navi
Post by NaviHan
I have a functionality where I click an a link from an email a
voucher gets added to the shopping cart and a pop up appears with a
message. Im trying to assert the text in the popup
Post by NaviHan
Post by NaviHan
I have defined the element as
div(:cta_description, :css =>
'.homepage-clicktoactiavte-description')
Post by NaviHan
Post by NaviHan
Tried to use a mix of Watir and Pageobejct to read the text.
The below code works 5 out of 10 times.
Post by NaviHan
Post by NaviHan
@rewards_popup_txt =
Watir::Wait.until{cta_description_element}.text
Post by NaviHan
Post by NaviHan
@rewards_popup_txt =
@rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
shows error
Post by NaviHan
Post by NaviHan
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt =
@rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Post by NaviHan
Post by NaviHan
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in
`rewards_popup_description'
Post by NaviHan
Post by NaviHan
Any stable way to do the job?
--
--
Before posting, please read
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
Post by NaviHan
In short: search before you ask, be nice.
http://groups.google.com/group/watir-general
---
You received this message because you are subscribed to the
Google Groups "Watir General" group.
Post by NaviHan
To unsubscribe from this group and stop receiving emails from
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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,
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
Justin Ko
2018-08-07 17:41:36 UTC
Permalink
I agree that adding it to the after hooks adds overhead. Though at 0.015s
per click, it's not the worst thing in the world.

I worked on one application where almost every button/link click triggered
a loading overlay. Creating a method for each button/link to add the wait
would defeat the purpose of using the Page Object gem. As with anything,
the "better way" really depends on the application you're testing.

Justin
Post by r***@gmail.com
Okay, I will be waiting for that then! There was a new project in my
company for which I convinced them to use WATIR instead of Selenium where I
had to implement this waiting behavior! Okay excited to see this new
feature to be added! Thanks.
Post by Titus Fortner
you'll be able to specify the exact desired behaviours in a more granular
way
Post by r***@gmail.com
Oh okay. But you said
The Executor class when implemented will open up a lot more flexibility.
So will it be lesser wire call after Executor class implemented? Can I
add after that?
Post by Titus Fortner
No, your way is better if it is working for you. Adding it to the after
hook will add a ton more unnecessary calls to your code.
Post by r***@gmail.com
That will be interesting, I am using as shown below,
def selectAndWait(locator, value)
select locator, value
waitForPageLoad
end
def waitForPageLoad
@b.wait_until(timeout: @Page_Load) {@b.execute_script("return (jQuery.active === 0)").eql? true}
end
Let me try using this `after_hook`, a very interesting idea indeed.
after any action that changes or is likely to change the dom, so it
can get heavy if overused. The Executor class when implemented will open up
a lot more flexibility.
Post by r***@gmail.com
Ah! that's pretty interesting, I was not knowing this. So you say
Once I have written this code, this code will be executed after every click
I do?
Post by Titus Fortner
jquery_wait = lambda { |br| br.wait_until { |b|
b.execute_script('return jQuery.active == 0') } }
browser.after_hooks.add(jquery_wait)
On Tuesday, August 7, 2018 at 9:17:32 AM UTC-7,
Post by r***@gmail.com
Hi Justin,
We are also using this wait_for_ajax in one of our Project. You said
I would suggest adding the jQuery.active check to your browser's
Post by Justin Ko
after_hooks. Ideally this would catch all (or at least most) of the
problems.
May I know how to do this?
Post by Justin Ko
The #wait_for_ajax simplifies things if you need to manually call
it. However, it sounds like you would have to sprinkle this everywhere.
Note that there would be a small performance hit of making this
check after each click/goto. However, if it's an AJAX heavy application,
it's probably worth it.
Justin
Post by Titus Fortner
Found it
http://cheezyworld.com/2012/02/23/page-object-0-6-2-released/
let's you call `wait_for_ajax` where you want it.
Post by NaviHan
Yes Justin, That was exactly what happened. I ran the script a
few times and using "Watir::Wait.until(timeout: 30)
error "
Post by NaviHan
Element <span class="swatchanchor-value">...</span> is not
clickable at point (537, 362). Other element would receive the click: <div
class="loader-bg"></div>"
Post by NaviHan
The code is
def select_online_size (size)
Watir::Wait.until(timeout: 30)
sizes_online_elements.find {|el| el.when_present.text.eql?
size}.click
Post by NaviHan
end
I was expecting that the "when_present" method would not give
any timing issue because this waits until the element is present. Somehow
this evaulates to true at the same time the spinner which is loading while
the Ajax is running receives the click.
Post by NaviHan
Is there a PO way to resolve this , I mean without having to
use the "jQuery" statement
Post by NaviHan
Cheers
Navi
Post by NaviHan
I have a functionality where I click an a link from an email
a voucher gets added to the shopping cart and a pop up appears with a
message. Im trying to assert the text in the popup
Post by NaviHan
Post by NaviHan
I have defined the element as
div(:cta_description, :css =>
'.homepage-clicktoactiavte-description')
Post by NaviHan
Post by NaviHan
Tried to use a mix of Watir and Pageobejct to read the text.
The below code works 5 out of 10 times.
Post by NaviHan
Post by NaviHan
@rewards_popup_txt =
Watir::Wait.until{cta_description_element}.text
Post by NaviHan
Post by NaviHan
@rewards_popup_txt =
@rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
shows error
Post by NaviHan
Post by NaviHan
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt =
@rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Post by NaviHan
Post by NaviHan
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in
`rewards_popup_description'
Post by NaviHan
Post by NaviHan
Any stable way to do the job?
--
--
Before posting, please read
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
Post by NaviHan
In short: search before you ask, be nice.
http://groups.google.com/group/watir-general
---
You received this message because you are subscribed to the
Google Groups "Watir General" group.
Post by NaviHan
To unsubscribe from this group and stop receiving emails from
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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,
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
rajagopalan madasami
2018-08-07 17:47:56 UTC
Permalink
Ah that's very negligible! I believe I can add that in my current project.
Post by Justin Ko
I agree that adding it to the after hooks adds overhead. Though at 0.015s
per click, it's not the worst thing in the world.
I worked on one application where almost every button/link click triggered
a loading overlay. Creating a method for each button/link to add the wait
would defeat the purpose of using the Page Object gem. As with anything,
the "better way" really depends on the application you're testing.
Justin
Post by r***@gmail.com
Okay, I will be waiting for that then! There was a new project in my
company for which I convinced them to use WATIR instead of Selenium where I
had to implement this waiting behavior! Okay excited to see this new
feature to be added! Thanks.
Post by Titus Fortner
you'll be able to specify the exact desired behaviours in a more
granular way
Post by r***@gmail.com
Oh okay. But you said
The Executor class when implemented will open up a lot more flexibility.
So will it be lesser wire call after Executor class implemented? Can I
add after that?
Post by Titus Fortner
No, your way is better if it is working for you. Adding it to the
after hook will add a ton more unnecessary calls to your code.
Post by r***@gmail.com
That will be interesting, I am using as shown below,
def selectAndWait(locator, value)
select locator, value
waitForPageLoad
end
def waitForPageLoad
@b.wait_until(timeout: @Page_Load) {@b.execute_script("return (jQuery.active === 0)").eql? true}
end
Let me try using this `after_hook`, a very interesting idea indeed.
after any action that changes or is likely to change the dom, so it
can get heavy if overused. The Executor class when implemented will open up
a lot more flexibility.
Post by r***@gmail.com
Ah! that's pretty interesting, I was not knowing this. So you say
Once I have written this code, this code will be executed after every click
I do?
Post by Titus Fortner
jquery_wait = lambda { |br| br.wait_until { |b|
b.execute_script('return jQuery.active == 0') } }
browser.after_hooks.add(jquery_wait)
On Tuesday, August 7, 2018 at 9:17:32 AM UTC-7,
Post by r***@gmail.com
Hi Justin,
We are also using this wait_for_ajax in one of our Project. You said
I would suggest adding the jQuery.active check to your browser's
Post by Justin Ko
after_hooks. Ideally this would catch all (or at least most) of the
problems.
May I know how to do this?
Post by Justin Ko
The #wait_for_ajax simplifies things if you need to manually
call it. However, it sounds like you would have to sprinkle this everywhere.
Note that there would be a small performance hit of making this
check after each click/goto. However, if it's an AJAX heavy application,
it's probably worth it.
Justin
Post by Titus Fortner
Found it
http://cheezyworld.com/2012/02/23/page-object-0-6-2-released/
let's you call `wait_for_ajax` where you want it.
Post by NaviHan
Yes Justin, That was exactly what happened. I ran the script
a few times and using "Watir::Wait.until(timeout: 30)
error "
Post by NaviHan
Element <span class="swatchanchor-value">...</span> is not
clickable at point (537, 362). Other element would receive the click: <div
class="loader-bg"></div>"
Post by NaviHan
The code is
def select_online_size (size)
Watir::Wait.until(timeout: 30)
sizes_online_elements.find {|el| el.when_present.text.eql?
size}.click
Post by NaviHan
end
I was expecting that the "when_present" method would not give
any timing issue because this waits until the element is present. Somehow
this evaulates to true at the same time the spinner which is loading while
the Ajax is running receives the click.
Post by NaviHan
Is there a PO way to resolve this , I mean without having to
use the "jQuery" statement
Post by NaviHan
Cheers
Navi
Post by NaviHan
I have a functionality where I click an a link from an email
a voucher gets added to the shopping cart and a pop up appears with a
message. Im trying to assert the text in the popup
Post by NaviHan
Post by NaviHan
I have defined the element as
div(:cta_description, :css =>
'.homepage-clicktoactiavte-description')
Post by NaviHan
Post by NaviHan
Tried to use a mix of Watir and Pageobejct to read the text.
The below code works 5 out of 10 times.
Post by NaviHan
Post by NaviHan
@rewards_popup_txt =
Watir::Wait.until{cta_description_element}.text
Post by NaviHan
Post by NaviHan
@rewards_popup_txt =
@rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
shows error
Post by NaviHan
Post by NaviHan
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt =
@rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Post by NaviHan
Post by NaviHan
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in
`rewards_popup_description'
Post by NaviHan
Post by NaviHan
Any stable way to do the job?
--
--
Before posting, please read
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
Post by NaviHan
In short: search before you ask, be nice.
http://groups.google.com/group/watir-general
---
You received this message because you are subscribed to the
Google Groups "Watir General" group.
Post by NaviHan
To unsubscribe from this group and stop receiving emails from
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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,
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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,
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
Titus Fortner
2018-08-07 17:54:03 UTC
Permalink
It's more than that when running remotely, though. Definitely use it if it
makes sense regardless of local or remote, but if you've solved your issue
by just wrapping the select method, that's targeted and "better." :)
Post by Justin Ko
I agree that adding it to the after hooks adds overhead. Though at 0.015s
per click, it's not the worst thing in the world.
I worked on one application where almost every button/link click triggered
a loading overlay. Creating a method for each button/link to add the wait
would defeat the purpose of using the Page Object gem. As with anything,
the "better way" really depends on the application you're testing.
Justin
Post by r***@gmail.com
Okay, I will be waiting for that then! There was a new project in my
company for which I convinced them to use WATIR instead of Selenium where I
had to implement this waiting behavior! Okay excited to see this new
feature to be added! Thanks.
Post by Titus Fortner
you'll be able to specify the exact desired behaviours in a more
granular way
Post by r***@gmail.com
Oh okay. But you said
The Executor class when implemented will open up a lot more flexibility.
So will it be lesser wire call after Executor class implemented? Can I
add after that?
Post by Titus Fortner
No, your way is better if it is working for you. Adding it to the
after hook will add a ton more unnecessary calls to your code.
Post by r***@gmail.com
That will be interesting, I am using as shown below,
def selectAndWait(locator, value)
select locator, value
waitForPageLoad
end
def waitForPageLoad
@b.wait_until(timeout: @Page_Load) {@b.execute_script("return (jQuery.active === 0)").eql? true}
end
Let me try using this `after_hook`, a very interesting idea indeed.
after any action that changes or is likely to change the dom, so it
can get heavy if overused. The Executor class when implemented will open up
a lot more flexibility.
Post by r***@gmail.com
Ah! that's pretty interesting, I was not knowing this. So you say
Once I have written this code, this code will be executed after every click
I do?
Post by Titus Fortner
jquery_wait = lambda { |br| br.wait_until { |b|
b.execute_script('return jQuery.active == 0') } }
browser.after_hooks.add(jquery_wait)
On Tuesday, August 7, 2018 at 9:17:32 AM UTC-7,
Post by r***@gmail.com
Hi Justin,
We are also using this wait_for_ajax in one of our Project. You said
I would suggest adding the jQuery.active check to your browser's
Post by Justin Ko
after_hooks. Ideally this would catch all (or at least most) of the
problems.
May I know how to do this?
Post by Justin Ko
The #wait_for_ajax simplifies things if you need to manually
call it. However, it sounds like you would have to sprinkle this everywhere.
Note that there would be a small performance hit of making this
check after each click/goto. However, if it's an AJAX heavy application,
it's probably worth it.
Justin
Post by Titus Fortner
Found it
http://cheezyworld.com/2012/02/23/page-object-0-6-2-released/
let's you call `wait_for_ajax` where you want it.
Post by NaviHan
Yes Justin, That was exactly what happened. I ran the script
a few times and using "Watir::Wait.until(timeout: 30)
error "
Post by NaviHan
Element <span class="swatchanchor-value">...</span> is not
clickable at point (537, 362). Other element would receive the click: <div
class="loader-bg"></div>"
Post by NaviHan
The code is
def select_online_size (size)
Watir::Wait.until(timeout: 30)
sizes_online_elements.find {|el| el.when_present.text.eql?
size}.click
Post by NaviHan
end
I was expecting that the "when_present" method would not give
any timing issue because this waits until the element is present. Somehow
this evaulates to true at the same time the spinner which is loading while
the Ajax is running receives the click.
Post by NaviHan
Is there a PO way to resolve this , I mean without having to
use the "jQuery" statement
Post by NaviHan
Cheers
Navi
Post by NaviHan
I have a functionality where I click an a link from an email
a voucher gets added to the shopping cart and a pop up appears with a
message. Im trying to assert the text in the popup
Post by NaviHan
Post by NaviHan
I have defined the element as
div(:cta_description, :css =>
'.homepage-clicktoactiavte-description')
Post by NaviHan
Post by NaviHan
Tried to use a mix of Watir and Pageobejct to read the text.
The below code works 5 out of 10 times.
Post by NaviHan
Post by NaviHan
@rewards_popup_txt =
Watir::Wait.until{cta_description_element}.text
Post by NaviHan
Post by NaviHan
@rewards_popup_txt =
@rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
shows error
Post by NaviHan
Post by NaviHan
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt =
@rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Post by NaviHan
Post by NaviHan
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in
`rewards_popup_description'
Post by NaviHan
Post by NaviHan
Any stable way to do the job?
--
--
Before posting, please read
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
Post by NaviHan
In short: search before you ask, be nice.
http://groups.google.com/group/watir-general
---
You received this message because you are subscribed to the
Google Groups "Watir General" group.
Post by NaviHan
To unsubscribe from this group and stop receiving emails from
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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,
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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,
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
rajagopalan madasami
2018-08-07 17:58:37 UTC
Permalink
I have created a framework where I specifically asked them to use click and
clickAndWait separately , click will simply performs the WATIR click,
clickAndWait will perform the WATIR click and call the function waitForLoad
as you have seen. So if such a hook is available that would be easy for me.
Post by Titus Fortner
It's more than that when running remotely, though. Definitely use it if it
makes sense regardless of local or remote, but if you've solved your issue
by just wrapping the select method, that's targeted and "better." :)
Post by Justin Ko
I agree that adding it to the after hooks adds overhead. Though at 0.015s
per click, it's not the worst thing in the world.
I worked on one application where almost every button/link click
triggered a loading overlay. Creating a method for each button/link to add
the wait would defeat the purpose of using the Page Object gem. As with
anything, the "better way" really depends on the application you're testing.
Justin
Post by r***@gmail.com
Okay, I will be waiting for that then! There was a new project in my
company for which I convinced them to use WATIR instead of Selenium where I
had to implement this waiting behavior! Okay excited to see this new
feature to be added! Thanks.
Post by Titus Fortner
you'll be able to specify the exact desired behaviours in a more
granular way
Post by r***@gmail.com
Oh okay. But you said
The Executor class when implemented will open up a lot more
Post by Titus Fortner
flexibility.
So will it be lesser wire call after Executor class implemented? Can I
add after that?
Post by Titus Fortner
No, your way is better if it is working for you. Adding it to the
after hook will add a ton more unnecessary calls to your code.
Post by r***@gmail.com
That will be interesting, I am using as shown below,
def selectAndWait(locator, value)
select locator, value
waitForPageLoad
end
def waitForPageLoad
@b.wait_until(timeout: @Page_Load) {@b.execute_script("return (jQuery.active === 0)").eql? true}
end
Let me try using this `after_hook`, a very interesting idea indeed.
after any action that changes or is likely to change the dom, so it
can get heavy if overused. The Executor class when implemented will open up
a lot more flexibility.
Post by r***@gmail.com
Ah! that's pretty interesting, I was not knowing this. So you say
Once I have written this code, this code will be executed after every click
I do?
Post by Titus Fortner
jquery_wait = lambda { |br| br.wait_until { |b|
b.execute_script('return jQuery.active == 0') } }
browser.after_hooks.add(jquery_wait)
On Tuesday, August 7, 2018 at 9:17:32 AM UTC-7,
Post by r***@gmail.com
Hi Justin,
We are also using this wait_for_ajax in one of our Project. You said
I would suggest adding the jQuery.active check to your browser's
Post by Justin Ko
after_hooks. Ideally this would catch all (or at least most) of the
problems.
May I know how to do this?
Post by Justin Ko
The #wait_for_ajax simplifies things if you need to manually
call it. However, it sounds like you would have to sprinkle this everywhere.
Note that there would be a small performance hit of making this
check after each click/goto. However, if it's an AJAX heavy application,
it's probably worth it.
Justin
Post by Titus Fortner
Found it
http://cheezyworld.com/2012/02/23/page-object-0-6-2-released/
let's you call `wait_for_ajax` where you want it.
Post by NaviHan
Yes Justin, That was exactly what happened. I ran the script
a few times and using "Watir::Wait.until(timeout: 30)
error "
Post by NaviHan
Element <span class="swatchanchor-value">...</span> is not
clickable at point (537, 362). Other element would receive the click: <div
class="loader-bg"></div>"
Post by NaviHan
The code is
def select_online_size (size)
Watir::Wait.until(timeout: 30)
sizes_online_elements.find {|el| el.when_present.text.eql?
size}.click
Post by NaviHan
end
I was expecting that the "when_present" method would not
give any timing issue because this waits until the element is present.
Somehow this evaulates to true at the same time the spinner which is
loading while the Ajax is running receives the click.
Post by NaviHan
Is there a PO way to resolve this , I mean without having to
use the "jQuery" statement
Post by NaviHan
Cheers
Navi
Post by NaviHan
I have a functionality where I click an a link from an
email a voucher gets added to the shopping cart and a pop up appears with a
message. Im trying to assert the text in the popup
Post by NaviHan
Post by NaviHan
I have defined the element as
div(:cta_description, :css =>
'.homepage-clicktoactiavte-description')
Post by NaviHan
Post by NaviHan
Tried to use a mix of Watir and Pageobejct to read the
text. The below code works 5 out of 10 times.
Post by NaviHan
Post by NaviHan
@rewards_popup_txt =
Watir::Wait.until{cta_description_element}.text
Post by NaviHan
Post by NaviHan
@rewards_popup_txt =
@rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
and shows error
Post by NaviHan
Post by NaviHan
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt =
@rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Post by NaviHan
Post by NaviHan
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in
`rewards_popup_description'
Post by NaviHan
Post by NaviHan
Any stable way to do the job?
--
--
Before posting, please read
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
Post by NaviHan
In short: search before you ask, be nice.
http://groups.google.com/group/watir-general
---
You received this message because you are subscribed to the
Google Groups "Watir General" group.
Post by NaviHan
To unsubscribe from this group and stop receiving emails
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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,
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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,
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
Titus Fortner
2018-08-07 18:14:42 UTC
Permalink
The poc code for Watir::Executor has been sitting in the PRs for a year:
https://github.com/watir/watir/pull/587

I was going to wait until Watir 7 to release it, but I don't think there is
anything backward-compatibility breaking in it, so I don't think I should
technically need to wait for that.




On Tue, Aug 7, 2018 at 10:58 AM rajagopalan madasami <
Post by rajagopalan madasami
I have created a framework where I specifically asked them to use click
and clickAndWait separately , click will simply performs the WATIR click,
clickAndWait will perform the WATIR click and call the function waitForLoad
as you have seen. So if such a hook is available that would be easy for me.
Post by Titus Fortner
It's more than that when running remotely, though. Definitely use it if
it makes sense regardless of local or remote, but if you've solved your
issue by just wrapping the select method, that's targeted and "better." :)
Post by Justin Ko
I agree that adding it to the after hooks adds overhead. Though at
0.015s per click, it's not the worst thing in the world.
I worked on one application where almost every button/link click
triggered a loading overlay. Creating a method for each button/link to add
the wait would defeat the purpose of using the Page Object gem. As with
anything, the "better way" really depends on the application you're testing.
Justin
Post by r***@gmail.com
Okay, I will be waiting for that then! There was a new project in my
company for which I convinced them to use WATIR instead of Selenium where I
had to implement this waiting behavior! Okay excited to see this new
feature to be added! Thanks.
Post by Titus Fortner
you'll be able to specify the exact desired behaviours in a more
granular way
Post by r***@gmail.com
Oh okay. But you said
The Executor class when implemented will open up a lot more
Post by Titus Fortner
flexibility.
So will it be lesser wire call after Executor class implemented? Can
I add after that?
Post by Titus Fortner
No, your way is better if it is working for you. Adding it to the
after hook will add a ton more unnecessary calls to your code.
Post by r***@gmail.com
That will be interesting, I am using as shown below,
def selectAndWait(locator, value)
select locator, value
waitForPageLoad
end
def waitForPageLoad
@b.wait_until(timeout: @Page_Load) {@b.execute_script("return (jQuery.active === 0)").eql? true}
end
Let me try using this `after_hook`, a very interesting idea indeed.
after any action that changes or is likely to change the dom, so
it can get heavy if overused. The Executor class when implemented will open
up a lot more flexibility.
Post by r***@gmail.com
Ah! that's pretty interesting, I was not knowing this. So you say
Once I have written this code, this code will be executed after every click
I do?
Post by Titus Fortner
jquery_wait = lambda { |br| br.wait_until { |b|
b.execute_script('return jQuery.active == 0') } }
browser.after_hooks.add(jquery_wait)
On Tuesday, August 7, 2018 at 9:17:32 AM UTC-7,
Post by r***@gmail.com
Hi Justin,
We are also using this wait_for_ajax in one of our Project. You said
I would suggest adding the jQuery.active check to your
browser's after_hooks. Ideally this would catch all (or at least most) of
the problems.
May I know how to do this?
The #wait_for_ajax simplifies things if you need to manually
call it. However, it sounds like you would have to sprinkle this everywhere.
Note that there would be a small performance hit of making
this check after each click/goto. However, if it's an AJAX heavy
application, it's probably worth it.
Justin
On Tuesday, August 7, 2018 at 11:36:54 AM UTC-4, Titus Fortner
Post by Titus Fortner
Found it
http://cheezyworld.com/2012/02/23/page-object-0-6-2-released/
let's you call `wait_for_ajax` where you want it.
Post by NaviHan
Yes Justin, That was exactly what happened. I ran the
script a few times and using "Watir::Wait.until(timeout: 30)
error "
Post by NaviHan
Element <span class="swatchanchor-value">...</span> is not
clickable at point (537, 362). Other element would receive the click: <div
class="loader-bg"></div>"
Post by NaviHan
The code is
def select_online_size (size)
Watir::Wait.until(timeout: 30)
sizes_online_elements.find {|el|
el.when_present.text.eql? size}.click
Post by NaviHan
end
I was expecting that the "when_present" method would not
give any timing issue because this waits until the element is present.
Somehow this evaulates to true at the same time the spinner which is
loading while the Ajax is running receives the click.
Post by NaviHan
Is there a PO way to resolve this , I mean without having
to use the "jQuery" statement
Post by NaviHan
Cheers
Navi
Post by NaviHan
I have a functionality where I click an a link from an
email a voucher gets added to the shopping cart and a pop up appears with a
message. Im trying to assert the text in the popup
Post by NaviHan
Post by NaviHan
I have defined the element as
div(:cta_description, :css =>
'.homepage-clicktoactiavte-description')
Post by NaviHan
Post by NaviHan
Tried to use a mix of Watir and Pageobejct to read the
text. The below code works 5 out of 10 times.
Post by NaviHan
Post by NaviHan
@rewards_popup_txt =
Watir::Wait.until{cta_description_element}.text
Post by NaviHan
Post by NaviHan
@rewards_popup_txt =
@rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
and shows error
Post by NaviHan
Post by NaviHan
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt =
@rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Post by NaviHan
Post by NaviHan
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in
`rewards_popup_description'
Post by NaviHan
Post by NaviHan
Any stable way to do the job?
--
--
Before posting, please read
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
Post by NaviHan
In short: search before you ask, be nice.
http://groups.google.com/group/watir-general
---
You received this message because you are subscribed to the
Google Groups "Watir General" group.
Post by NaviHan
To unsubscribe from this group and stop receiving emails
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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,
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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,
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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,
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
rajagopalan madasami
2018-08-07 18:25:58 UTC
Permalink
I have already read this thread , thank you.
Post by Titus Fortner
https://github.com/watir/watir/pull/587
I was going to wait until Watir 7 to release it, but I don't think there
is anything backward-compatibility breaking in it, so I don't think I
should technically need to wait for that.
On Tue, Aug 7, 2018 at 10:58 AM rajagopalan madasami <
Post by rajagopalan madasami
I have created a framework where I specifically asked them to use click
and clickAndWait separately , click will simply performs the WATIR click,
clickAndWait will perform the WATIR click and call the function waitForLoad
as you have seen. So if such a hook is available that would be easy for me.
Post by Titus Fortner
It's more than that when running remotely, though. Definitely use it if
it makes sense regardless of local or remote, but if you've solved your
issue by just wrapping the select method, that's targeted and "better." :)
Post by Justin Ko
I agree that adding it to the after hooks adds overhead. Though at
0.015s per click, it's not the worst thing in the world.
I worked on one application where almost every button/link click
triggered a loading overlay. Creating a method for each button/link to add
the wait would defeat the purpose of using the Page Object gem. As with
anything, the "better way" really depends on the application you're testing.
Justin
Post by r***@gmail.com
Okay, I will be waiting for that then! There was a new project in my
company for which I convinced them to use WATIR instead of Selenium where I
had to implement this waiting behavior! Okay excited to see this new
feature to be added! Thanks.
Post by Titus Fortner
you'll be able to specify the exact desired behaviours in a more
granular way
Post by r***@gmail.com
Oh okay. But you said
The Executor class when implemented will open up a lot more
Post by Titus Fortner
flexibility.
So will it be lesser wire call after Executor class implemented? Can
I add after that?
Post by Titus Fortner
No, your way is better if it is working for you. Adding it to the
after hook will add a ton more unnecessary calls to your code.
Post by r***@gmail.com
That will be interesting, I am using as shown below,
def selectAndWait(locator, value)
select locator, value
waitForPageLoad
end
def waitForPageLoad
@b.wait_until(timeout: @Page_Load) {@b.execute_script("return (jQuery.active === 0)").eql? true}
end
Let me try using this `after_hook`, a very interesting idea indeed.
after any action that changes or is likely to change the dom, so
it can get heavy if overused. The Executor class when implemented will open
up a lot more flexibility.
Post by r***@gmail.com
Ah! that's pretty interesting, I was not knowing this. So you
say Once I have written this code, this code will be executed after every
click I do?
Post by Titus Fortner
jquery_wait = lambda { |br| br.wait_until { |b|
b.execute_script('return jQuery.active == 0') } }
browser.after_hooks.add(jquery_wait)
On Tuesday, August 7, 2018 at 9:17:32 AM UTC-7,
Post by r***@gmail.com
Hi Justin,
We are also using this wait_for_ajax in one of our Project.
You said
I would suggest adding the jQuery.active check to your
browser's after_hooks. Ideally this would catch all (or at least most) of
the problems.
May I know how to do this?
The #wait_for_ajax simplifies things if you need to manually
call it. However, it sounds like you would have to sprinkle this everywhere.
Note that there would be a small performance hit of making
this check after each click/goto. However, if it's an AJAX heavy
application, it's probably worth it.
Justin
On Tuesday, August 7, 2018 at 11:36:54 AM UTC-4, Titus
Post by Titus Fortner
Found it
http://cheezyworld.com/2012/02/23/page-object-0-6-2-released/
let's you call `wait_for_ajax` where you want it.
Post by NaviHan
Yes Justin, That was exactly what happened. I ran the
script a few times and using "Watir::Wait.until(timeout: 30)
error "
Post by NaviHan
Element <span class="swatchanchor-value">...</span> is not
clickable at point (537, 362). Other element would receive the click: <div
class="loader-bg"></div>"
Post by NaviHan
The code is
def select_online_size (size)
Watir::Wait.until(timeout: 30)
sizes_online_elements.find {|el|
el.when_present.text.eql? size}.click
Post by NaviHan
end
I was expecting that the "when_present" method would not
give any timing issue because this waits until the element is present.
Somehow this evaulates to true at the same time the spinner which is
loading while the Ajax is running receives the click.
Post by NaviHan
Is there a PO way to resolve this , I mean without having
to use the "jQuery" statement
Post by NaviHan
Cheers
Navi
Post by NaviHan
I have a functionality where I click an a link from an
email a voucher gets added to the shopping cart and a pop up appears with a
message. Im trying to assert the text in the popup
Post by NaviHan
Post by NaviHan
I have defined the element as
div(:cta_description, :css =>
'.homepage-clicktoactiavte-description')
Post by NaviHan
Post by NaviHan
Tried to use a mix of Watir and Pageobejct to read the
text. The below code works 5 out of 10 times.
Post by NaviHan
Post by NaviHan
@rewards_popup_txt =
Watir::Wait.until{cta_description_element}.text
Post by NaviHan
Post by NaviHan
@rewards_popup_txt =
@rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
and shows error
Post by NaviHan
Post by NaviHan
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt =
@rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Post by NaviHan
Post by NaviHan
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in
`rewards_popup_description'
Post by NaviHan
Post by NaviHan
Any stable way to do the job?
--
--
Before posting, please read
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
Post by NaviHan
In short: search before you ask, be nice.
http://groups.google.com/group/watir-general
---
You received this message because you are subscribed to
the Google Groups "Watir General" group.
Post by NaviHan
To unsubscribe from this group and stop receiving emails
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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,
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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,
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
NaviHan
2018-08-08 05:46:20 UTC
Permalink
Hi Titus and Justin

"wait_for_ajax" did the job :-) I used it only at places where the spinner
loading caused problem. Im curios where to put the code blok Titus provided
in the hooks.rb file
My hooks look like this.

@Justin, Im curios to know why you asked if Im sure that the timing issue
was resolved using the jQuery statement. Are these kind of issues caused by
something else?


require 'rubygems'
require 'page-object'
require 'watir'
require 'page-object/page_factory'
require 'log4r'
require 'cucumber'
require 'selenium-webdriver'
require 'fig_newton'




Before do|scenario|

case ENV["TEST_ENV"]

when 'dev'
begin
ENV['HTTP_PROXY'] = ENV['http_proxy'] = nil
@browser = Watir::Browser.new :chrome
@browser.window.maximize
@browser.driver.manage.timeouts.implicit_wait = 300
@browser.cookies.clear
@browser.driver.manage.window.maximize
PageObject.default_element_wait=(10)
FigNewton.load( "#{ENV["TEST_ENV"]}" + ".yml")
PageObject.javascript_framework = :jquery
end
when 'dev04'
begin
ENV['HTTP_PROXY'] = ENV['http_proxy'] = nil
@browser = Watir::Browser.new :chrome
@browser.window.maximize
@browser.driver.manage.timeouts.implicit_wait = 300
@browser.cookies.clear
@browser.driver.manage.window.maximize
PageObject.default_element_wait=(10)
FigNewton.load( "#{ENV["TEST_ENV"]}" + ".yml")
PageObject.javascript_framework = :jquery
end
else
ENV['HTTP_PROXY'] = ENV['http_proxy'] = nil
@browser = Watir::Browser.new :chrome
@browser.window.maximize
@browser.driver.manage.timeouts.implicit_wait = 300
@browser.cookies.clear
@browser.driver.manage.window.maximize
PageObject.default_element_wait=(10)
FigNewton.load( "dev04.yml")
PageObject.javascript_framework = :jquery
end

end #before scenario




# "after all"
After do |scenario|
@browser.driver.quit
if (scenario.passed?)
puts 'Scenario Passed !'
else
puts 'Scenario Failed !'
end
end



AfterStep('@screen') do
filename = DateTime.now.strftime("%d%b%Y%H%M%S")
@browser.screenshot.save ("C:/Users/lohit.kotian/Documents/Automation/screenshots-cucumber/#{filename}.png")
#@browser.screenshot.save ("C:/Jenkins/workspace/screenshots-cucumber/#{filename}.png")
end


Around('@multipletimes') do |scenario, block|
$counter = 0
$total_times_to_run = 6
while $counter < $total_times_to_run do
block.call
puts("Total times scripts were repeated = #$counter" )
$counter +=1
end
end


After do |scenario|
take_screenshot(@browser, scenario)
end

# need to check this code for the full page screenshots as a part of the enhancement

def take_screenshot(browser, scenario)
time = Time.now.strftime("%Y-%m-%d_%H%M")
if scenario.failed?
scenario_name = scenario.name.gsub(/[^\w\-]/, ' ')
screenshot_path = "#{scenario_name}" + "_failure_" + time
@browser.screenshot.save("./screenshots/#{screenshot_path}.png")
end

end


I would require your help to clear my doubts about "wait while" and "wait
until". I see this is something extensively used in out project but no one
has a clear answer.A grep gave me this
./features/support/pages/Frontend/COG/Checkout_Page.rb: Watir::Wait.while
{order_summ_content_element.visible?}
./features/support/pages/Frontend/COG/Paypal_Page.rb: Watir::Wait.while {
paypal_logo_element.visible?}
./features/support/pages/Frontend/COG/Paypal_Page.rb: Watir::Wait.while {
paypal_spinner_element.visible?}
./features/support/pages/Frontend/COG/Pdp_Page.rb: if Watir::Wait.while {
olapped_sm_window_element.visible?}
./features/support/pages/Frontend/COG/Pdp_Page.rb: # Watir::Wait.while
{stores_elements[9].visible?}
./features/support/pages/Frontend/COG/Pdp_Page.rb: Watir::Wait.while {
stores_elements[9].visible?}
./features/support/pages/Frontend/COG/Thankyou_Page.rb: return Watir::
Wait.while {@browser.text.include?('Did you enjoy your shopping experience
today')}


And Wait.until is used everywhere and the list is huge
./features/support/pages/Frontend/COG/Pdp_Page.rb: #
Watir::Wait.until {check_stores_element}.click
./features/support/pages/Frontend/COG/Pdp_Page.rb: #return
Watir::Wait.until {el}.parent(:index => 1).attribute('class') if
el.text.include? "#{size}"
./features/support/pages/Frontend/COG/Pdp_Page.rb: #return
Watir::Wait.until {el}.parent.attribute('class') if
el.span_element.text.include? "#{size}"
./features/support/pages/Frontend/COG/Pdp_Page.rb: #return
Watir::Wait.until {search_string_element}.attribute('value')
./features/support/pages/Frontend/COG/Pdp_Page.rb: #return
Watir::Wait.until {search_string_element}.attribute('value')
./features/support/pages/Frontend/COG/Pdp_Page.rb: @succ_txt = Watir
::Wait.until {pdp_success_msg_block_element}.text
./features/support/pages/Frontend/COG/Pdp_Page.rb: Watir::Wait.until(
timeout: 30){add_to_bag_element.enabled?}
./features/support/pages/Frontend/COG/Search_Page.rb: Watir::Wait.
until {search_field_element}.when_present.clear
./features/support/pages/Frontend/COG/Search_Page.rb: Watir::Wait.
until {search_field_element}.when_present.click
./features/support/pages/Frontend/COG/Search_Page.rb: Watir::Wait.
until {search_field_element}.when_present.set(arg)
Post by NaviHan
I have a functionality where I click an a link from an email a voucher
gets added to the shopping cart and a pop up appears with a message. Im
trying to assert the text in the popup
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below
code works 5 out of 10 times.
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in `
rewards_popup_description'
Any stable way to do the job?
--
--
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.
rajagopalan madasami
2018-08-08 05:50:49 UTC
Permalink
Hi you don't have to use implicit wait while you use WATIR , that's needed
if you use pure selenium binding. If you use implicit wait, then you can't
know the element status immediately. Don't use implicit wait, WATIR has its
own waiting strategy.
Post by NaviHan
Hi Titus and Justin
"wait_for_ajax" did the job :-) I used it only at places where the spinner
loading caused problem. Im curios where to put the code blok Titus provided
in the hooks.rb file
My hooks look like this.
@Justin, Im curios to know why you asked if Im sure that the timing issue
was resolved using the jQuery statement. Are these kind of issues caused by
something else?
require 'rubygems'
require 'page-object'
require 'watir'
require 'page-object/page_factory'
require 'log4r'
require 'cucumber'
require 'selenium-webdriver'
require 'fig_newton'
Before do|scenario|
case ENV["TEST_ENV"]
when 'dev'
begin
ENV['HTTP_PROXY'] = ENV['http_proxy'] = nil
@browser = Watir::Browser.new :chrome
@browser.window.maximize
@browser.driver.manage.timeouts.implicit_wait = 300
@browser.cookies.clear
@browser.driver.manage.window.maximize
PageObject.default_element_wait=(10)
FigNewton.load( "#{ENV["TEST_ENV"]}" + ".yml")
PageObject.javascript_framework = :jquery
end
when 'dev04'
begin
ENV['HTTP_PROXY'] = ENV['http_proxy'] = nil
@browser = Watir::Browser.new :chrome
@browser.window.maximize
@browser.driver.manage.timeouts.implicit_wait = 300
@browser.cookies.clear
@browser.driver.manage.window.maximize
PageObject.default_element_wait=(10)
FigNewton.load( "#{ENV["TEST_ENV"]}" + ".yml")
PageObject.javascript_framework = :jquery
end
else
ENV['HTTP_PROXY'] = ENV['http_proxy'] = nil
@browser = Watir::Browser.new :chrome
@browser.window.maximize
@browser.driver.manage.timeouts.implicit_wait = 300
@browser.cookies.clear
@browser.driver.manage.window.maximize
PageObject.default_element_wait=(10)
FigNewton.load( "dev04.yml")
PageObject.javascript_framework = :jquery
end
end #before scenario
# "after all"
After do |scenario|
@browser.driver.quit
if (scenario.passed?)
puts 'Scenario Passed !'
else
puts 'Scenario Failed !'
end
end
filename = DateTime.now.strftime("%d%b%Y%H%M%S")
@browser.screenshot.save ("C:/Users/lohit.kotian/Documents/Automation/screenshots-cucumber/#{filename}.png")
end
$counter = 0
$total_times_to_run = 6
while $counter < $total_times_to_run do
block.call
puts("Total times scripts were repeated = #$counter" )
$counter +=1
end
end
After do |scenario|
end
# need to check this code for the full page screenshots as a part of the enhancement
def take_screenshot(browser, scenario)
time = Time.now.strftime("%Y-%m-%d_%H%M")
if scenario.failed?
scenario_name = scenario.name.gsub(/[^\w\-]/, ' ')
screenshot_path = "#{scenario_name}" + "_failure_" + time
@browser.screenshot.save("./screenshots/#{screenshot_path}.png")
end
end
I would require your help to clear my doubts about "wait while" and "wait
until". I see this is something extensively used in out project but no one
has a clear answer.A grep gave me this
./features/support/pages/Frontend/COG/Checkout_Page.rb: Watir::Wait.
while {order_summ_content_element.visible?}
./features/support/pages/Frontend/COG/Paypal_Page.rb: Watir::Wait.while
{paypal_logo_element.visible?}
./features/support/pages/Frontend/COG/Paypal_Page.rb: Watir::Wait.while
{paypal_spinner_element.visible?}
./features/support/pages/Frontend/COG/Pdp_Page.rb: if Watir::Wait.while
{olapped_sm_window_element.visible?}
./features/support/pages/Frontend/COG/Pdp_Page.rb: # Watir::Wait.while
{stores_elements[9].visible?}
./features/support/pages/Frontend/COG/Pdp_Page.rb: Watir::Wait.while {
stores_elements[9].visible?}
experience today')}
And Wait.until is used everywhere and the list is huge
./features/support/pages/Frontend/COG/Pdp_Page.rb: #
Watir::Wait.until {check_stores_element}.click
./features/support/pages/Frontend/COG/Pdp_Page.rb: #return
Watir::Wait.until {el}.parent(:index => 1).attribute('class') if
el.text.include? "#{size}"
./features/support/pages/Frontend/COG/Pdp_Page.rb: #return
Watir::Wait.until {el}.parent.attribute('class') if
el.span_element.text.include? "#{size}"
./features/support/pages/Frontend/COG/Pdp_Page.rb: #return
Watir::Wait.until {search_string_element}.attribute('value')
./features/support/pages/Frontend/COG/Pdp_Page.rb: #return
Watir::Wait.until {search_string_element}.attribute('value')
Watir::Wait.until {pdp_success_msg_block_element}.text
./features/support/pages/Frontend/COG/Pdp_Page.rb: Watir::Wait.
until(timeout: 30){add_to_bag_element.enabled?}
./features/support/pages/Frontend/COG/Search_Page.rb: Watir::Wait.
until {search_field_element}.when_present.clear
./features/support/pages/Frontend/COG/Search_Page.rb: Watir::Wait.
until {search_field_element}.when_present.click
./features/support/pages/Frontend/COG/Search_Page.rb: Watir::Wait.
until {search_field_element}.when_present.set(arg)
Post by NaviHan
I have a functionality where I click an a link from an email a voucher
gets added to the shopping cart and a pop up appears with a message. Im
trying to assert the text in the popup
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below
code works 5 out of 10 times.
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in `
rewards_popup_description'
Any stable way to do the job?
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
Titus Fortner
2018-08-08 06:44:20 UTC
Permalink
Oh wow, implicit_wait of 300 will likely cause issues even if you aren't
using Watir. Definitely don't need it with Watir. I kind of want to change
the Selenium code to expose the existing implicit wait value in the driver
just so Watir can check for it and throw big warning flags saying not to
set it. :)
Post by rajagopalan madasami
Hi you don't have to use implicit wait while you use WATIR , that's needed
if you use pure selenium binding. If you use implicit wait, then you can't
know the element status immediately. Don't use implicit wait, WATIR has its
own waiting strategy.
Post by NaviHan
Hi Titus and Justin
"wait_for_ajax" did the job :-) I used it only at places where the
spinner loading caused problem. Im curios where to put the code blok Titus
provided in the hooks.rb file
My hooks look like this.
@Justin, Im curios to know why you asked if Im sure that the timing issue
was resolved using the jQuery statement. Are these kind of issues caused by
something else?
require 'rubygems'
require 'page-object'
require 'watir'
require 'page-object/page_factory'
require 'log4r'
require 'cucumber'
require 'selenium-webdriver'
require 'fig_newton'
Before do|scenario|
case ENV["TEST_ENV"]
when 'dev'
begin
ENV['HTTP_PROXY'] = ENV['http_proxy'] = nil
@browser = Watir::Browser.new :chrome
@browser.window.maximize
@browser.driver.manage.timeouts.implicit_wait = 300
@browser.cookies.clear
@browser.driver.manage.window.maximize
PageObject.default_element_wait=(10)
FigNewton.load( "#{ENV["TEST_ENV"]}" + ".yml")
PageObject.javascript_framework = :jquery
end
when 'dev04'
begin
ENV['HTTP_PROXY'] = ENV['http_proxy'] = nil
@browser = Watir::Browser.new :chrome
@browser.window.maximize
@browser.driver.manage.timeouts.implicit_wait = 300
@browser.cookies.clear
@browser.driver.manage.window.maximize
PageObject.default_element_wait=(10)
FigNewton.load( "#{ENV["TEST_ENV"]}" + ".yml")
PageObject.javascript_framework = :jquery
end
else
ENV['HTTP_PROXY'] = ENV['http_proxy'] = nil
@browser = Watir::Browser.new :chrome
@browser.window.maximize
@browser.driver.manage.timeouts.implicit_wait = 300
@browser.cookies.clear
@browser.driver.manage.window.maximize
PageObject.default_element_wait=(10)
FigNewton.load( "dev04.yml")
PageObject.javascript_framework = :jquery
end
end #before scenario<span style="color:#000" class="m_-3767466441214720462styled-by-p
--
--
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.
rajagopalan madasami
2018-08-08 06:47:51 UTC
Permalink
Yeah, that would be good idea. Our waiting methodology is what we differ
tremendously from directly using Selenium. When they use this driver level
wait, that would hinder WATIR to do its job as expected.
Post by Titus Fortner
Oh wow, implicit_wait of 300 will likely cause issues even if you aren't
using Watir. Definitely don't need it with Watir. I kind of want to change
the Selenium code to expose the existing implicit wait value in the driver
just so Watir can check for it and throw big warning flags saying not to
set it. :)
Post by rajagopalan madasami
Hi you don't have to use implicit wait while you use WATIR , that's
needed if you use pure selenium binding. If you use implicit wait, then you
can't know the element status immediately. Don't use implicit wait, WATIR
has its own waiting strategy.
Post by NaviHan
Hi Titus and Justin
"wait_for_ajax" did the job :-) I used it only at places where the
spinner loading caused problem. Im curios where to put the code blok Titus
provided in the hooks.rb file
My hooks look like this.
@Justin, Im curios to know why you asked if Im sure that the timing
issue was resolved using the jQuery statement. Are these kind of issues
caused by something else?
require 'rubygems'
require 'page-object'
require 'watir'
require 'page-object/page_factory'
require 'log4r'
require 'cucumber'
require 'selenium-webdriver'
require 'fig_newton'
Before do|scenario|
case ENV["TEST_ENV"]
when 'dev'
begin
ENV['HTTP_PROXY'] = ENV['http_proxy'] = nil
@browser = Watir::Browser.new :chrome
@browser.window.maximize
@browser.driver.manage.timeouts.implicit_wait = 300
@browser.cookies.clear
@browser.driver.manage.window.maximize
PageObject.default_element_wait=(10)
FigNewton.load( "#{ENV["TEST_ENV"]}" + ".yml")
PageObject.javascript_framework = :jquery
end
when 'dev04'
begin
ENV['HTTP_PROXY'] = ENV['http_proxy'] = nil
@browser = Watir::Browser.new :chrome
@browser.window.maximize
@browser.driver.manage.timeouts.implicit_wait = 300
@browser.cookies.clear
@browser.driver.manage.window.maximize
PageObject.default_element_wait=(10)
FigNewton.load( "#{ENV["TEST_ENV"]}" + ".yml")
PageObject.javascript_framework = :jquery
end
else
ENV['HTTP_PROXY'] = ENV['http_proxy'] = nil
@browser = Watir::Browser.new :chrome
@browser.window.maximize
@browser.driver.manage.timeouts.implicit_wait = 300
@browser.cookies.clear
@browser.driver.manage.window.maximize
PageObject.default_element_wait=(10)
FigNewton.load( "dev04.yml")
PageObject.javascript_framework = :jquery
end
end #before scenario<span style="color:#000" class="m_-3767466441214720462styled-by-p
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
NaviHan
2018-08-08 11:47:32 UTC
Permalink
Hi Titus and Rajagopalan and Justin

The hook is written by another automation engineer, so Im yet to understand
that fully.
Considering Im new to automation Im going through the learning curve and
you guys are of immense help.
Tomorrow I will be debugging the script in Jenkins box as to why reading
the text from the popup fails just to remind this topic was started for
that and in the midst we nailed the javascript issue. The confusion with
wait_until and wait_while still bothers me.

Let me make it a bit more clearer to you.

1. The pop up appears and Im trying to assert two texts in that popup.
2. On local this passes but on Jenkins box the text is being read as empty

So Im thinking in the line, wait while the pop up disappears during that
time read the texts in the pop up. I have this idea in mind but dont know
how to implement that.
These are the methods..

def rewards_popup_description
#return cta_description_element.when_present.text.gsub(/[^$,.A-Za-z0-9]/," ")
return cta_description_element.when_present(timeout = 10).text.gsub(/[^$,.A-Za-z0-9]/," ")

end


def rewards_popup_expiration
return cta_expiry_element.when_present(timeout = 10).text.gsub(/[^$,.A-Za-z0-9]/," ")
end


Instead of this can I do something like

def rewards_popup_description
#return cta_description_element.when_present.text.gsub(/[^$,.A-Za-z0-9]/," ")
return cta_description_element.when_present(timeout = 10).text.gsub(/[^$,.A-Za-z0-9]/," ")


end


def rewards_popup_expiration
return cta_expiry_element.when_present(timeout = 10).text.gsub(/[^$,.A-Za-z0-9]/," ")
end
Post by NaviHan
I have a functionality where I click an a link from an email a voucher
gets added to the shopping cart and a pop up appears with a message. Im
trying to assert the text in the popup
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below
code works 5 out of 10 times.
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in `
rewards_popup_description'
Any stable way to do the job?
--
--
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.
NaviHan
2018-08-08 11:54:16 UTC
Permalink
***Please ignore previous message. It was accidently sent before typing
completely"

Hi Titus and Rajagopalan and Justin

The hook is written by another automation engineer, so Im yet to understand
that fully.
Considering Im new to automation Im going through the learning curve and
you guys are of immense help.
Tomorrow I will be debugging the script in Jenkins box as to why reading
the text from the popup fails just to remind this topic was started for
that and in the midst we nailed the javascript issue. The confusion with
wait_until and wait_while still bothers me.

Let me make it a bit more clearer to you.

1. The pop up appears and Im trying to assert two texts in that popup.
2. On local this passes but on Jenkins box the text is being read as empty

So Im thinking in the line, wait while the pop up disappears during that
time read the texts in the pop up. I have this idea in mind but dont know
how to implement that.
These are the methods..

def rewards_popup_description
#return cta_description_element.when_present.text.gsub(/[^$,.A-Za-z0-9]/," ")
return cta_description_element.when_present(timeout = 10).text.gsub(/[^$,.A-Za-z0-9]/," ")

end


def rewards_popup_expiration
return cta_expiry_element.when_present(timeout = 10).text.gsub(/[^$,.A-Za-z0-9]/," ")
end


Instead of this can I do something like, note :- in BOLD is PSEUDO CODE

cta_description_element.wait_while do
cta_description_element.visible? AND READ THE TEXT
end


cheers
Post by NaviHan
I have a functionality where I click an a link from an email a voucher
gets added to the shopping cart and a pop up appears with a message. Im
trying to assert the text in the popup
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below
code works 5 out of 10 times.
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in `
rewards_popup_description'
Any stable way to do the job?
--
--
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.
rajagopalan madasami
2018-08-08 16:03:00 UTC
Permalink
Hi Titus,

Can I know who is fixing and releasing this logs? Is it from our WATIR
team?

https://raw.githubusercontent.com/SeleniumHQ/selenium/master/rb/CHANGES
Post by NaviHan
***Please ignore previous message. It was accidently sent before typing
completely"
Hi Titus and Rajagopalan and Justin
The hook is written by another automation engineer, so Im yet to
understand that fully.
Considering Im new to automation Im going through the learning curve and
you guys are of immense help.
Tomorrow I will be debugging the script in Jenkins box as to why reading
the text from the popup fails just to remind this topic was started for
that and in the midst we nailed the javascript issue. The confusion with
wait_until and wait_while still bothers me.
Let me make it a bit more clearer to you.
1. The pop up appears and Im trying to assert two texts in that popup.
2. On local this passes but on Jenkins box the text is being read as empty
So Im thinking in the line, wait while the pop up disappears during that
time read the texts in the pop up. I have this idea in mind but dont know
how to implement that.
These are the methods..
def rewards_popup_description
#return cta_description_element.when_present.text.gsub(/[^$,.A-Za-z0-9]/," ")
return cta_description_element.when_present(timeout = 10).text.gsub(/[^$,.A-Za-z0-9]/," ")
end
def rewards_popup_expiration
return cta_expiry_element.when_present(timeout = 10).text.gsub(/[^$,.A-Za-z0-9]/," ")
end
Instead of this can I do something like, note :- in BOLD is PSEUDO CODE
cta_description_element.wait_while do
cta_description_element.visible? AND READ THE TEXT
end
cheers
Post by NaviHan
I have a functionality where I click an a link from an email a voucher
gets added to the shopping cart and a pop up appears with a message. Im
trying to assert the text in the popup
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below
code works 5 out of 10 times.
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in `
rewards_popup_description'
Any stable way to do the job?
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
Titus Fortner
2018-08-08 16:13:10 UTC
Permalink
Let's keep questions in threads relevant to the thread being
discussed. Alex (p0deje) does the Ruby work right now, with help from
Thomas (twalpole), Lucas (lucast) and me.

NaviHan, I'll have time to look at this later today.
On Wed, Aug 8, 2018 at 9:03 AM rajagopalan madasami
Post by rajagopalan madasami
Hi Titus,
Can I know who is fixing and releasing this logs? Is it from our WATIR team?
https://raw.githubusercontent.com/SeleniumHQ/selenium/master/rb/CHANGES
***Please ignore previous message. It was accidently sent before typing completely"
Hi Titus and Rajagopalan and Justin
The hook is written by another automation engineer, so Im yet to understand that fully.
Considering Im new to automation Im going through the learning curve and you guys are of immense help.
Tomorrow I will be debugging the script in Jenkins box as to why reading the text from the popup fails just to remind this topic was started for that and in the midst we nailed the javascript issue. The confusion with wait_until and wait_while still bothers me.
Let me make it a bit more clearer to you.
1. The pop up appears and Im trying to assert two texts in that popup.
2. On local this passes but on Jenkins box the text is being read as empty
So Im thinking in the line, wait while the pop up disappears during that time read the texts in the pop up. I have this idea in mind but dont know how to implement that.
These are the methods..
def rewards_popup_description
#return cta_description_element.when_present.text.gsub(/[^$,.A-Za-z0-9]/," ")
return cta_description_element.when_present(timeout = 10).text.gsub(/[^$,.A-Za-z0-9]/," ")
end
def rewards_popup_expiration
return cta_expiry_element.when_present(timeout = 10).text.gsub(/[^$,.A-Za-z0-9]/," ")
end
Instead of this can I do something like, note :- in BOLD is PSEUDO CODE
cta_description_element.wait_while do
cta_description_element.visible? AND READ THE TEXT
end
cheers
I have a functionality where I click an a link from an email a voucher gets added to the shopping cart and a pop up appears with a message. Im trying to assert the text in the popup
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below code works 5 out of 10 times.
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in `rewards_popup_description'
Any stable way to do the job?
--
--
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.
http://groups.google.com/group/watir-general
---
You received this message because you are subscribed to the Google Groups "Watir General" group.
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
You received this message because you are subscribed to the Google Groups "Watir General" group.
For more options, visit https://groups.google.com/d/optout.
--
--
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.
rajagopalan madasami
2018-08-08 16:34:42 UTC
Permalink
Okay thank you.
Post by Titus Fortner
Let's keep questions in threads relevant to the thread being
discussed. Alex (p0deje) does the Ruby work right now, with help from
Thomas (twalpole), Lucas (lucast) and me.
NaviHan, I'll have time to look at this later today.
On Wed, Aug 8, 2018 at 9:03 AM rajagopalan madasami
Post by rajagopalan madasami
Hi Titus,
Can I know who is fixing and releasing this logs? Is it from our WATIR
team?
Post by rajagopalan madasami
https://raw.githubusercontent.com/SeleniumHQ/selenium/master/rb/CHANGES
Post by NaviHan
***Please ignore previous message. It was accidently sent before typing
completely"
Post by rajagopalan madasami
Post by NaviHan
Hi Titus and Rajagopalan and Justin
The hook is written by another automation engineer, so Im yet to
understand that fully.
Post by rajagopalan madasami
Post by NaviHan
Considering Im new to automation Im going through the learning curve
and you guys are of immense help.
Post by rajagopalan madasami
Post by NaviHan
Tomorrow I will be debugging the script in Jenkins box as to why
reading the text from the popup fails just to remind this topic was started
for that and in the midst we nailed the javascript issue. The confusion
with wait_until and wait_while still bothers me.
Post by rajagopalan madasami
Post by NaviHan
Let me make it a bit more clearer to you.
1. The pop up appears and Im trying to assert two texts in that popup.
2. On local this passes but on Jenkins box the text is being read as
empty
Post by rajagopalan madasami
Post by NaviHan
So Im thinking in the line, wait while the pop up disappears during
that time read the texts in the pop up. I have this idea in mind but dont
know how to implement that.
Post by rajagopalan madasami
Post by NaviHan
These are the methods..
def rewards_popup_description
#return cta_description_element.when_present.text.gsub(/[^$,.A-Za-z0-9]/,"
")
Post by rajagopalan madasami
Post by NaviHan
return cta_description_element.when_present(timeout =
10).text.gsub(/[^$,.A-Za-z0-9]/," ")
Post by rajagopalan madasami
Post by NaviHan
end
def rewards_popup_expiration
return cta_expiry_element.when_present(timeout =
10).text.gsub(/[^$,.A-Za-z0-9]/," ")
Post by rajagopalan madasami
Post by NaviHan
end
Instead of this can I do something like, note :- in BOLD is PSEUDO CODE
cta_description_element.wait_while do
cta_description_element.visible? AND READ THE TEXT
end
cheers
Post by NaviHan
I have a functionality where I click an a link from an email a voucher
gets added to the shopping cart and a pop up appears with a message. Im
trying to assert the text in the popup
Post by rajagopalan madasami
Post by NaviHan
Post by NaviHan
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below
code works 5 out of 10 times.
Post by rajagopalan madasami
Post by NaviHan
Post by NaviHan
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
error
Post by rajagopalan madasami
Post by NaviHan
Post by NaviHan
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in
`rewards_popup_description'
Post by rajagopalan madasami
Post by NaviHan
Post by NaviHan
Any stable way to do the job?
--
--
Before posting, please read https://github.com/watir/
watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
Post by rajagopalan madasami
Post by NaviHan
In short: search before you ask, be nice.
http://groups.google.com/group/watir-general
---
You received this message because you are subscribed to the Google
Groups "Watir General" group.
Post by rajagopalan madasami
Post by NaviHan
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
--
Before posting, please read https://github.com/watir/
watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
Post by rajagopalan madasami
In short: search before you ask, be nice.
http://groups.google.com/group/watir-general
---
You received this message because you are subscribed to the Google
Groups "Watir General" group.
Post by rajagopalan madasami
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
Titus Fortner
2018-08-08 18:35:43 UTC
Permalink
In general, what is going on remotely is that the page is taking
slightly longer to load relative to what you have locally, so the
Selenium command is trying to execute before the site is ready for it

Does this help to explain the difference between #wait_until and #wait_while?

browser.wait_until { true } # => returns immediately
browser.wait_until { false } # => will time out
browser.wait_while { true } # => will time out
browser.wait_while { false } # => returns immediately
Post by NaviHan
2. On local this passes but on Jenkins box the text is being read as empty
Text will return as empty if the element exists, but it not yet visible.
Ideally waiting for text to not be "" should be automatic, but
implementing that with the current code we have is not trivial. :(

So in for now you need to explicitly wait for it to become present first:

cta_description_element.wait_until(&:present?).text.gsub(/[^$,.A-Za-z0-9]/," ")

Based on our conversation here, I just added code that will go into
the next version of Watir that will allow you to do this (which might
be easier to understand?):

cta_description_element.wait_while(text: "").text.gsub(/[^$,.A-Za-z0-9]/," ")
Post by NaviHan
***Please ignore previous message. It was accidently sent before typing completely"
Hi Titus and Rajagopalan and Justin
The hook is written by another automation engineer, so Im yet to understand that fully.
Considering Im new to automation Im going through the learning curve and you guys are of immense help.
Tomorrow I will be debugging the script in Jenkins box as to why reading the text from the popup fails just to remind this topic was started for that and in the midst we nailed the javascript issue. The confusion with wait_until and wait_while still bothers me.
Let me make it a bit more clearer to you.
1. The pop up appears and Im trying to assert two texts in that popup.
2. On local this passes but on Jenkins box the text is being read as empty
So Im thinking in the line, wait while the pop up disappears during that time read the texts in the pop up. I have this idea in mind but dont know how to implement that.
These are the methods..
def rewards_popup_description
#return cta_description_element.when_present.text.gsub(/[^$,.A-Za-z0-9]/," ")
return cta_description_element.when_present(timeout = 10).text.gsub(/[^$,.A-Za-z0-9]/," ")
end
def rewards_popup_expiration
return cta_expiry_element.when_present(timeout = 10).text.gsub(/[^$,.A-Za-z0-9]/," ")
end
Instead of this can I do something like, note :- in BOLD is PSEUDO CODE
cta_description_element.wait_while do
cta_description_element.visible? AND READ THE TEXT
end
cheers
I have a functionality where I click an a link from an email a voucher gets added to the shopping cart and a pop up appears with a message. Im trying to assert the text in the popup
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below code works 5 out of 10 times.
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in `rewards_popup_description'
Any stable way to do the job?
--
--
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.
http://groups.google.com/group/watir-general
---
You received this message because you are subscribed to the Google Groups "Watir General" group.
For more options, visit https://groups.google.com/d/optout.
--
--
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.
NaviHan
2018-08-09 01:25:58 UTC
Permalink
Hi Titus

Thanks for taking time to clarify things. Really appreciate it.
In Fact I tried
"cta_description_element.wait_until(&:present?).text.gsub(/[^$,.A-Za-z0-9]/,"
")" unfortunately that was also read as "", hence the confusion.
Let me try to run the script directly on Jenkins box, will post the outcome

I understood the difference between wait_while and wait_until.
The confusion is as explained below
browser.wait_while { false } # => returns immediately
While waiting for this to be false can the script do something? Othrwise
does the below code makes sense? Script is waiting for the text to be empty
, while waiting it has to read the content of the text...

def rewards_popup_description
cta_description_element.wait_while do
cta_description_element.text == ""
return cta_description_element.when_present.text.gsub(/[^$,.A-Za-z0-9]/," ")
end
end
Post by NaviHan
I have a functionality where I click an a link from an email a voucher
gets added to the shopping cart and a pop up appears with a message. Im
trying to assert the text in the popup
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below
code works 5 out of 10 times.
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in `
rewards_popup_description'
Any stable way to do the job?
--
--
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.
NaviHan
2018-08-09 02:24:47 UTC
Permalink
Hi Titus/Justin

Extremely strange things happening in remote box when I directly ran the
script from there.

Im using this in local and remote
def rewards_popup_expiration
return cta_expiry_element.when_present.text.gsub(/[^$,.A-Za-z0-9]/," ")
end

On local this passes in the sense it gets the text and asserts it to true
However in remote its complaing as
And the customer sees the overlay popup message "$10 reward activated"
features/step_definitions/Loyalty_steps.rb:7

timed out after 30 seconds, Element not present in 30 seconds (Watir::Wait::TimeoutError)

C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/watir-6.12.0/lib/watir/wait.rb:49:in `until'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/watir-6.12.0/lib/watir/wait.rb:126:in `wait_until'
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/page-object-2.2.4/lib/page-object/elements/element.rb:133:in `when_present'
D:/Jenkins/workspace/cog-checkout-loyalty-nightly-cuke-tests/cuke-tests/features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:14:in `rewards_popup_description'
D:/Jenkins/workspace/cog-checkout-loyalty-nightly-cuke-tests/cuke-tests/features/step_definitions/Loyalty_steps.rb:9:in `block (2 levels) in '
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/page-object-2.2.4/lib/page-object/page_factory.rb:75:in `on_page'
D:/Jenkins/workspace/cog-checkout-loyalty-nightly-cuke-tests/cuke-tests/features/step_definitions/Loyalty_steps.rb:8:in `block in '
C:/Ruby24-x64/bin/cucumber:23:in `load'
C:/Ruby24-x64/bin/cucumber:23:in `'
features/Loyalty-AU.feature:122:in `And the customer sees the overlay popup message "$10 reward activated"'


I did a quick verification of watir, and pageobect versions. Both are
same... Any clue???
On local

Gems included by the bundle:
* actionpack (5.2.0)
* actionview (5.2.0)
* activemodel (5.2.0)
* activerecord (5.2.0)
* activerecord-oracle_enhanced-adapter (5.2.2)
* activesupport (5.2.0)
* addressable (2.5.2)
* arel (9.0.0)
* backports (3.11.3)
* builder (3.2.3)
* bundler (1.16.2)
* childprocess (0.9.0)
* concurrent-ruby (1.0.5)
* connection_pool (2.2.2)
* crass (1.0.4)
* cucumber (3.1.2)
* cucumber-core (3.2.0)
* cucumber-expressions (6.0.1)
* cucumber-tag_expressions (1.1.1)
* cucumber-wire (0.0.1)
* data_magic (1.2)
* diff-lcs (1.3)
* domain_name (0.5.20180417)
* erubi (1.7.1)
* faker (1.9.1)
* ffi (1.9.25)
* fig_newton (1.0)
* gherkin (5.1.0)
* http-cookie (1.0.3)
* i18n (1.0.1)
* json (2.1.0)
* log4r (1.1.10)
* loofah (2.2.2)
* mime-types (3.1)
* mime-types-data (3.2016.0521)
* mini_portile2 (2.3.0)
* minitest (5.11.3)
* multi_json (1.13.1)
* multi_test (0.1.2)
* net-http-persistent (3.0.0)
* netrc (0.11.0)
* nokogiri (1.8.4)
* page-object (2.2.4)
* page_navigation (0.10)
* parallel (1.12.1)
* parallel_tests (2.22.0)
* pretty_face (0.10.3)
* public_suffix (3.0.2)
* rack (2.0.5)
* rack-test (1.1.0)
* rails-dom-testing (2.0.3)
* rails-html-sanitizer (1.0.4)
* rake (12.3.1)
* require_all (2.0.0)
* rest-client (2.0.2)
* rspec (3.8.0)
* rspec-core (3.8.0)
* rspec-expectations (3.8.1)
* rspec-mocks (3.8.0)
* rspec-support (3.8.0)
* ruby-oci8 (2.2.5.1)
* ruby-ole (1.2.12.1)
* ruby-plsql (0.6.0)
* ruby-rc4 (0.1.5)
* rubyzip (1.2.1)
* sauce_whisk (0.1.0)
* saucelabs (0.5)
* selenium-webdriver (3.14.0)
* syntax (1.2.2)
* thread_safe (0.3.6)
* tzinfo (1.2.5)
* unf (0.1.4)
* unf_ext (0.0.7.5)
* watir (6.12.0)
* watir-scroll (0.2.0)
* watir-webdriver (0.9.9)
* yard (0.9.15)
* yard-cucumber (4.0.0)
* yml_reader (0.7)

On remote
Gems included by the bundle:
* actionpack (5.2.0)
* actionview (5.2.0)
* activemodel (5.2.0)
* activerecord (5.2.0)
* activerecord-oracle_enhanced-adapter (5.2.2)
* activesupport (5.2.0)
* addressable (2.5.2)
* arel (9.0.0)
* backports (3.11.3)
* builder (3.2.3)
* bundler (1.16.3)
* childprocess (0.9.0)
* concurrent-ruby (1.0.5)
* connection_pool (2.2.2)
* crass (1.0.4)
* cucumber (3.1.2)
* cucumber-core (3.2.0)
* cucumber-expressions (6.0.1)
* cucumber-tag_expressions (1.1.1)
* cucumber-wire (0.0.1)
* data_magic (1.2)
* diff-lcs (1.3)
* domain_name (0.5.20180417)
* erubi (1.7.1)
* faker (1.9.1)
* ffi (1.9.25)
* fig_newton (1.0)
* gherkin (5.1.0)
* http-cookie (1.0.3)
* i18n (1.0.1)
* json (2.1.0)
* log4r (1.1.10)
* loofah (2.2.2)
* mime-types (3.1)
* mime-types-data (3.2016.0521)
* mini_portile2 (2.3.0)
* minitest (5.11.3)
* multi_json (1.13.1)
* multi_test (0.1.2)
* net-http-persistent (3.0.0)
* netrc (0.11.0)
* nokogiri (1.8.4)
* page-object (2.2.4)
* page_navigation (0.10)
* parallel (1.12.1)
* parallel_tests (2.22.0)
* pretty_face (0.10.3)
* public_suffix (3.0.2)
* rack (2.0.5)
* rack-test (1.1.0)
* rails-dom-testing (2.0.3)
* rails-html-sanitizer (1.0.4)
* rake (12.3.1)
* require_all (2.0.0)
* rest-client (2.0.2)
* rspec (3.7.0)
* rspec-core (3.7.1)
* rspec-expectations (3.7.0)
* rspec-mocks (3.7.0)
* rspec-support (3.7.1)
* ruby-oci8 (2.2.5.1)
* ruby-ole (1.2.12.1)
* ruby-plsql (0.6.0)
* ruby-rc4 (0.1.5)
* rubyzip (1.2.1)
* sauce_whisk (0.1.0)
* saucelabs (0.5)
* selenium-webdriver (3.13.1)
* syntax (1.2.2)
* thread_safe (0.3.6)
* tzinfo (1.2.5)
* unf (0.1.4)
* unf_ext (0.0.7.5)
* watir (6.12.0)
* watir-scroll (0.2.0)
* watir-webdriver (0.9.9)
* yard (0.9.15)
* yard-cucumber (4.0.0)
* yml_reader (0.7)
Post by NaviHan
I have a functionality where I click an a link from an email a voucher
gets added to the shopping cart and a pop up appears with a message. Im
trying to assert the text in the popup
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below
code works 5 out of 10 times.
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in `
rewards_popup_description'
Any stable way to do the job?
--
--
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.
Titus Fortner
2018-08-09 03:12:54 UTC
Permalink
Can you take a screenshot? Often the problem part is the step before the error, so you need to actually see what is happening. No waiting strategy will work if the element never becomes present.
--
--
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.
NaviHan
2018-08-09 03:23:40 UTC
Permalink
Yes Titus. I took the screenshot as well.
It shows the homepage of the site, without the popup.
Basically the popup appears on the homepage for 10second(this is driven by
config) and after 10 seconds it disappears. This is where we are trying to
read the text of the popup.

The screenshot show the homepage without the popup...
Post by NaviHan
I have a functionality where I click an a link from an email a voucher
gets added to the shopping cart and a pop up appears with a message. Im
trying to assert the text in the popup
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below
code works 5 out of 10 times.
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in `
rewards_popup_description'
Any stable way to do the job?
--
--
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.
Titus Fortner
2018-08-10 03:28:01 UTC
Permalink
So are you thinking the popup had already gone away on remote? Are you
sure it was ever opened in the first place? 10 seconds should be
plenty of time to get information off of something. Is there something
happening on the site or in the code that would keep you from getting
that information in that 10 seconds?
Post by NaviHan
Yes Titus. I took the screenshot as well.
It shows the homepage of the site, without the popup.
Basically the popup appears on the homepage for 10second(this is driven by config) and after 10 seconds it disappears. This is where we are trying to read the text of the popup.
The screenshot show the homepage without the popup...
I have a functionality where I click an a link from an email a voucher gets added to the shopping cart and a pop up appears with a message. Im trying to assert the text in the popup
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below code works 5 out of 10 times.
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in `rewards_popup_description'
Any stable way to do the job?
--
--
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.
http://groups.google.com/group/watir-general
---
You received this message because you are subscribed to the Google Groups "Watir General" group.
For more options, visit https://groups.google.com/d/optout.
--
--
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.
Navi
2018-08-10 04:28:03 UTC
Permalink
Hi Titus

I ran the script directly from Jenkins box. Its a Windows Server 2016
edition.
When the script runs I can see the popup appears and its stays for
10seconds(configured time) and then disappears. Then it fails complaining
"Element no found".

The local is Windows 7 machine..
Very very strange...
Post by Titus Fortner
So are you thinking the popup had already gone away on remote? Are you
sure it was ever opened in the first place? 10 seconds should be
plenty of time to get information off of something. Is there something
happening on the site or in the code that would keep you from getting
that information in that 10 seconds?
Post by NaviHan
Yes Titus. I took the screenshot as well.
It shows the homepage of the site, without the popup.
Basically the popup appears on the homepage for 10second(this is driven
by config) and after 10 seconds it disappears. This is where we are trying
to read the text of the popup.
Post by NaviHan
The screenshot show the homepage without the popup...
Post by NaviHan
I have a functionality where I click an a link from an email a voucher
gets added to the shopping cart and a pop up appears with a message. Im
trying to assert the text in the popup
Post by NaviHan
Post by NaviHan
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below
code works 5 out of 10 times.
Post by NaviHan
Post by NaviHan
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in
`rewards_popup_description'
Post by NaviHan
Post by NaviHan
Any stable way to do the job?
--
--
Before posting, please read https://github.com/watir/
watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
Post by NaviHan
In short: search before you ask, be nice.
http://groups.google.com/group/watir-general
---
You received this message because you are subscribed to the Google
Groups "Watir General" group.
Post by NaviHan
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
rajagopalan madasami
2018-08-10 04:43:13 UTC
Permalink
Hi please add WATIR tag in stack overflow. People will be looking into that
always.
Post by NaviHan
Hi Titus
I ran the script directly from Jenkins box. Its a Windows Server 2016
edition.
When the script runs I can see the popup appears and its stays for
10seconds(configured time) and then disappears. Then it fails complaining
"Element no found".
The local is Windows 7 machine..
Very very strange...
Post by Titus Fortner
So are you thinking the popup had already gone away on remote? Are you
sure it was ever opened in the first place? 10 seconds should be
plenty of time to get information off of something. Is there something
happening on the site or in the code that would keep you from getting
that information in that 10 seconds?
Post by NaviHan
Yes Titus. I took the screenshot as well.
It shows the homepage of the site, without the popup.
Basically the popup appears on the homepage for 10second(this is driven
by config) and after 10 seconds it disappears. This is where we are trying
to read the text of the popup.
Post by NaviHan
The screenshot show the homepage without the popup...
Post by NaviHan
I have a functionality where I click an a link from an email a voucher
gets added to the shopping cart and a pop up appears with a message. Im
trying to assert the text in the popup
Post by NaviHan
Post by NaviHan
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below
code works 5 out of 10 times.
Post by NaviHan
Post by NaviHan
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
error
Post by NaviHan
Post by NaviHan
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in
`rewards_popup_description'
Post by NaviHan
Post by NaviHan
Any stable way to do the job?
--
--
Before posting, please read
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group
.
Post by NaviHan
In short: search before you ask, be nice.
http://groups.google.com/group/watir-general
---
You received this message because you are subscribed to the Google
Groups "Watir General" group.
Post by NaviHan
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
--
--
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.
NaviHan
2018-08-10 00:50:36 UTC
Permalink
I posted the issue in stackoverflow :-(
https://stackoverflow.com/questions/51777433/element-not-found-exception-in-jenkins-box-while-script-passing-in-local
Post by NaviHan
I have a functionality where I click an a link from an email a voucher
gets added to the shopping cart and a pop up appears with a message. Im
trying to assert the text in the popup
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below
code works 5 out of 10 times.
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in `
rewards_popup_description'
Any stable way to do the job?
--
--
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.
NaviHan
2018-08-14 01:50:45 UTC
Permalink
All

Even javascript is failing with same reason. So this again passed in Local machine but failed with the same reason on the Jenkins box. WTF!!!

def rewards_popup_description
#return cta_description_element.when_present.text.gsub(/[^$,.A-Za-z0-9]/," ")
return @browser.execute_script('return document.getElementsByClassName("homepage-clickactivate-popup")[0];').text.gsub(/[^$,.A-Za-z0-9]/," ")

end

def rewards_popup_expiration
#return cta_expiry_element.when_present.text.gsub(/[^$,.A-Za-z0-9]/," ")
return @browser.execute_script('return document.getElementsByClassName("expiration-days")[0];').text.gsub(/[^$,.A-Za-z0-9]/," ")
end



expected "" to include "$10 reward activated" (RSpec::Expectations::
ExpectationNotMetError)
./features/step_definitions/Loyalty_steps.rb:9:in `block (2 levels) in '
./features/step_definitions/Loyalty_steps.rb:8:in `/^the customer sees the
overlay popup message "([^"]*)"$/'
features/Loyalty-AU.feature:122:in `And the customer sees the overlay popup
message "$10 reward activated"'
--
--
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.
NaviHan
2018-09-11 05:06:13 UTC
Permalink
Hi guys

I wanted to give an update on this issue.

A lot had changed in the project which now gives a stable run.
The jenkins box was running slow because the Java SE binary was eating 90%
of memory all the time. Once I killed and reinstalled it the tests are
running at lightning speed.This has fixed a lot of issues.

With this pop up , the time it stays open was driven by a timer in the
code. I have increased the timer and that gives the script enough time to
read the text. I also found sometimes the scripts still fails to read the
text, 1 out of 20 times. I suspect the focus is lost so Im thinking of
making the focus to the pop up before reading the text.

With the above changes Im getting stable runs now.
Post by NaviHan
I have a functionality where I click an a link from an email a voucher
gets added to the shopping cart and a pop up appears with a message. Im
trying to assert the text in the popup
I have defined the element as
div(:cta_description, :css => '.homepage-clicktoactiavte-description')
Tried to use a mix of Watir and Pageobejct to read the text. The below
code works 5 out of 10 times.
@rewards_popup_txt = Watir::Wait.until{cta_description_element}.text
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
if (Watir::Wait.while {cta_description_element.visible?})
@rewards_popup_txt = cta_description_element.text
end
@rewards_popup_txt = @rewards_popup_txt.gsub(/[^$,.A-Za-z0-9]/," ")
Error
NoMethodError: undefined method `gsub' for nil:NilClass
./features/support/pages/Frontend/Cotton_On/Loyalty_Page.rb:22:in `
rewards_popup_description'
Any stable way to do the job?
--
--
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.
r***@gmail.com
2018-09-12 16:50:25 UTC
Permalink
Just wanted to tell you, one more gem was released for page object, did you check that out? Its watirpump.
--
--
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.
Loading...