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

On Friday, 3 August 2018 15:12:45 UTC+10, NaviHan wrote:
>
> 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-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to