[wtr-general] Re: Difference in behaviour of .text method in Watir and FireWatir.
Thank you so much Ethan.. We would surely try and implement this snippet and get back in case we face any issues. Thanks again, Betsy Joy On Feb 10, 8:54 pm, Ethan notet...@gmail.com wrote: The difference between firefox and IE generally being on whitespace, you can match text by matching a regexp which splits on whitespace. Instead of element.text.include?(New Delhi to Mumbai) try element.text.match(/^New\s+Delhi\s+to\s+Mumbai$/) you could generalize this into a method like class Watir::Element def text_include_ignore_whitespace?(string_to_match) tokens=string_to_match.split(/\s+/) regexp_to_match=Regexp.new(tokens.map{|token| Regexp.escape(token)}.join([\\s\302\240]+), nil, 'U') return !!(self.text =~ regexp_to_match) end end then element.text_include_ignore_whitespace?(New Delhi to Mumbai) should return true. On Wed, Feb 10, 2010 at 04:35, Angrez Singh ang...@gmail.com wrote: What differences do you see when you use the .HTML method? - Angrez On Wed, Feb 10, 2010 at 2:51 PM, Betsy Joy joybe...@gmail.com wrote: Hi Angrez, Thanks for the suggestion. If it is the thread by Pallavi that your referred to, well we are together trying to use Firewatir and Watir for Automation. Initially we had used the .html method for the Text verification process on the page, but that did not work for us since it was returning extra portions of malformed tags which was corrupting our results. And so we migrated to using .text method instead. Now that even this is giving us trouble, we are trying to build a wrapper around this method to be able to mimic the .text method of Watir. Kindly let us know if this behaviour of introducing newline characters is limited to formatting tags or is it something deeper? This information will help us to decide if and how we could build the wrapper we require. Have a nice day !! Thanks and Regards, Betsy Joy. On 10 February 2010 13:30, Angrez Singh ang...@gmail.com wrote: There was another thread on the same issue by somebody else also. The thing is both IE and Firefox implements the 'text' method for elements in different ways. What I would suggest is if you can go and match the HTML content. Let me know if that works. Thanks, Angrez On Wed, Feb 10, 2010 at 1:03 PM, Betsy joybe...@gmail.com wrote: Hi Angrez, We have a scenario wherein we need to confirm the presence of a particular text string on a page. String as it appears on screen = New Delhi to Mumbai Html = bNew Delhi/b to bMumbai/b String returned by .text in Watir = New Delhi to Mumbai String returned by .text in FiewWatir = New Delhi to Mumbai Due to this difference in the behaviour of .text, my validation fails everytime I try doing a ff.text.include? New Delhi to Mumbai in FireWatir. There is a Jira ticket already open with regard to the .text method for FireWatir. Could you please let us know if this newline is being introduced due to the presence of formatting tags and if so is it limited to Formatting tags only? Thanks in advance, Betsy Joy -- You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -- You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general
[wtr-general] Re: Difference in behaviour of .text method in Watir and FireWatir.
Hi Ethan, Tried to use element.text.match(/^New\s+Delhi\s+to\s+Mumbai$/) but it returned nil and so failed. Where do I look for the reason for the same? Thanks, Betsy Joy. On Feb 10, 8:54 pm, Ethan notet...@gmail.com wrote: The difference between firefox and IE generally being on whitespace, you can match text by matching a regexp which splits on whitespace. Instead of element.text.include?(New Delhi to Mumbai) try element.text.match(/^New\s+Delhi\s+to\s+Mumbai$/) you could generalize this into a method like class Watir::Element def text_include_ignore_whitespace?(string_to_match) tokens=string_to_match.split(/\s+/) regexp_to_match=Regexp.new(tokens.map{|token| Regexp.escape(token)}.join([\\s\302\240]+), nil, 'U') return !!(self.text =~ regexp_to_match) end end then element.text_include_ignore_whitespace?(New Delhi to Mumbai) should return true. On Wed, Feb 10, 2010 at 04:35, Angrez Singh ang...@gmail.com wrote: What differences do you see when you use the .HTML method? - Angrez On Wed, Feb 10, 2010 at 2:51 PM, Betsy Joy joybe...@gmail.com wrote: Hi Angrez, Thanks for the suggestion. If it is the thread by Pallavi that your referred to, well we are together trying to use Firewatir and Watir for Automation. Initially we had used the .html method for the Text verification process on the page, but that did not work for us since it was returning extra portions of malformed tags which was corrupting our results. And so we migrated to using .text method instead. Now that even this is giving us trouble, we are trying to build a wrapper around this method to be able to mimic the .text method of Watir. Kindly let us know if this behaviour of introducing newline characters is limited to formatting tags or is it something deeper? This information will help us to decide if and how we could build the wrapper we require. Have a nice day !! Thanks and Regards, Betsy Joy. On 10 February 2010 13:30, Angrez Singh ang...@gmail.com wrote: There was another thread on the same issue by somebody else also. The thing is both IE and Firefox implements the 'text' method for elements in different ways. What I would suggest is if you can go and match the HTML content. Let me know if that works. Thanks, Angrez On Wed, Feb 10, 2010 at 1:03 PM, Betsy joybe...@gmail.com wrote: Hi Angrez, We have a scenario wherein we need to confirm the presence of a particular text string on a page. String as it appears on screen = New Delhi to Mumbai Html = bNew Delhi/b to bMumbai/b String returned by .text in Watir = New Delhi to Mumbai String returned by .text in FiewWatir = New Delhi to Mumbai Due to this difference in the behaviour of .text, my validation fails everytime I try doing a ff.text.include? New Delhi to Mumbai in FireWatir. There is a Jira ticket already open with regard to the .text method for FireWatir. Could you please let us know if this newline is being introduced due to the presence of formatting tags and if so is it limited to Formatting tags only? Thanks in advance, Betsy Joy -- You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -- You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general
[wtr-general] Re: Difference in behaviour of .text method in Watir and FireWatir.
There was another thread on the same issue by somebody else also. The thing is both IE and Firefox implements the 'text' method for elements in different ways. What I would suggest is if you can go and match the HTML content. Let me know if that works. Thanks, Angrez On Wed, Feb 10, 2010 at 1:03 PM, Betsy joybe...@gmail.com wrote: Hi Angrez, We have a scenario wherein we need to confirm the presence of a particular text string on a page. String as it appears on screen = New Delhi to Mumbai Html = bNew Delhi/b to bMumbai/b String returned by .text in Watir = New Delhi to Mumbai String returned by .text in FiewWatir = New Delhi to Mumbai Due to this difference in the behaviour of .text, my validation fails everytime I try doing a ff.text.include? New Delhi to Mumbai in FireWatir. There is a Jira ticket already open with regard to the .text method for FireWatir. Could you please let us know if this newline is being introduced due to the presence of formatting tags and if so is it limited to Formatting tags only? Thanks in advance, Betsy Joy -- You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general
[wtr-general] Re: Difference in behaviour of .text method in Watir and FireWatir.
Hi Angrez, Thanks for the suggestion. If it is the thread by Pallavi that your referred to, well we are together trying to use Firewatir and Watir for Automation. Initially we had used the .html method for the Text verification process on the page, but that did not work for us since it was returning extra portions of malformed tags which was corrupting our results. And so we migrated to using .text method instead. Now that even this is giving us trouble, we are trying to build a wrapper around this method to be able to mimic the .text method of Watir. Kindly let us know if this behaviour of introducing newline characters is limited to formatting tags or is it something deeper? This information will help us to decide if and how we could build the wrapper we require. Have a nice day !! Thanks and Regards, Betsy Joy. On 10 February 2010 13:30, Angrez Singh ang...@gmail.com wrote: There was another thread on the same issue by somebody else also. The thing is both IE and Firefox implements the 'text' method for elements in different ways. What I would suggest is if you can go and match the HTML content. Let me know if that works. Thanks, Angrez On Wed, Feb 10, 2010 at 1:03 PM, Betsy joybe...@gmail.com wrote: Hi Angrez, We have a scenario wherein we need to confirm the presence of a particular text string on a page. String as it appears on screen = New Delhi to Mumbai Html = bNew Delhi/b to bMumbai/b String returned by .text in Watir = New Delhi to Mumbai String returned by .text in FiewWatir = New Delhi to Mumbai Due to this difference in the behaviour of .text, my validation fails everytime I try doing a ff.text.include? New Delhi to Mumbai in FireWatir. There is a Jira ticket already open with regard to the .text method for FireWatir. Could you please let us know if this newline is being introduced due to the presence of formatting tags and if so is it limited to Formatting tags only? Thanks in advance, Betsy Joy -- You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general
[wtr-general] Re: Difference in behaviour of .text method in Watir and FireWatir.
What differences do you see when you use the .HTML method? - Angrez On Wed, Feb 10, 2010 at 2:51 PM, Betsy Joy joybe...@gmail.com wrote: Hi Angrez, Thanks for the suggestion. If it is the thread by Pallavi that your referred to, well we are together trying to use Firewatir and Watir for Automation. Initially we had used the .html method for the Text verification process on the page, but that did not work for us since it was returning extra portions of malformed tags which was corrupting our results. And so we migrated to using .text method instead. Now that even this is giving us trouble, we are trying to build a wrapper around this method to be able to mimic the .text method of Watir. Kindly let us know if this behaviour of introducing newline characters is limited to formatting tags or is it something deeper? This information will help us to decide if and how we could build the wrapper we require. Have a nice day !! Thanks and Regards, Betsy Joy. On 10 February 2010 13:30, Angrez Singh ang...@gmail.com wrote: There was another thread on the same issue by somebody else also. The thing is both IE and Firefox implements the 'text' method for elements in different ways. What I would suggest is if you can go and match the HTML content. Let me know if that works. Thanks, Angrez On Wed, Feb 10, 2010 at 1:03 PM, Betsy joybe...@gmail.com wrote: Hi Angrez, We have a scenario wherein we need to confirm the presence of a particular text string on a page. String as it appears on screen = New Delhi to Mumbai Html = bNew Delhi/b to bMumbai/b String returned by .text in Watir = New Delhi to Mumbai String returned by .text in FiewWatir = New Delhi to Mumbai Due to this difference in the behaviour of .text, my validation fails everytime I try doing a ff.text.include? New Delhi to Mumbai in FireWatir. There is a Jira ticket already open with regard to the .text method for FireWatir. Could you please let us know if this newline is being introduced due to the presence of formatting tags and if so is it limited to Formatting tags only? Thanks in advance, Betsy Joy -- You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general
Re: [wtr-general] Re: Difference in behaviour of .text method in Watir and FireWatir.
The difference between firefox and IE generally being on whitespace, you can match text by matching a regexp which splits on whitespace. Instead of element.text.include?(New Delhi to Mumbai) try element.text.match(/^New\s+Delhi\s+to\s+Mumbai$/) you could generalize this into a method like class Watir::Element def text_include_ignore_whitespace?(string_to_match) tokens=string_to_match.split(/\s+/) regexp_to_match=Regexp.new(tokens.map{|token| Regexp.escape(token) }.join([\\s\302\240]+), nil, 'U') return !!(self.text =~ regexp_to_match) end end then element.text_include_ignore_whitespace?(New Delhi to Mumbai) should return true. On Wed, Feb 10, 2010 at 04:35, Angrez Singh ang...@gmail.com wrote: What differences do you see when you use the .HTML method? - Angrez On Wed, Feb 10, 2010 at 2:51 PM, Betsy Joy joybe...@gmail.com wrote: Hi Angrez, Thanks for the suggestion. If it is the thread by Pallavi that your referred to, well we are together trying to use Firewatir and Watir for Automation. Initially we had used the .html method for the Text verification process on the page, but that did not work for us since it was returning extra portions of malformed tags which was corrupting our results. And so we migrated to using .text method instead. Now that even this is giving us trouble, we are trying to build a wrapper around this method to be able to mimic the .text method of Watir. Kindly let us know if this behaviour of introducing newline characters is limited to formatting tags or is it something deeper? This information will help us to decide if and how we could build the wrapper we require. Have a nice day !! Thanks and Regards, Betsy Joy. On 10 February 2010 13:30, Angrez Singh ang...@gmail.com wrote: There was another thread on the same issue by somebody else also. The thing is both IE and Firefox implements the 'text' method for elements in different ways. What I would suggest is if you can go and match the HTML content. Let me know if that works. Thanks, Angrez On Wed, Feb 10, 2010 at 1:03 PM, Betsy joybe...@gmail.com wrote: Hi Angrez, We have a scenario wherein we need to confirm the presence of a particular text string on a page. String as it appears on screen = New Delhi to Mumbai Html = bNew Delhi/b to bMumbai/b String returned by .text in Watir = New Delhi to Mumbai String returned by .text in FiewWatir = New Delhi to Mumbai Due to this difference in the behaviour of .text, my validation fails everytime I try doing a ff.text.include? New Delhi to Mumbai in FireWatir. There is a Jira ticket already open with regard to the .text method for FireWatir. Could you please let us know if this newline is being introduced due to the presence of formatting tags and if so is it limited to Formatting tags only? Thanks in advance, Betsy Joy -- You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -- You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general