Thank you John,Ethan. it is my bad..the text is displayed inside the frame. $ie.frame(:name,"Main").text.include? is working
On Dec 2, 3:48 pm, mohe <[email protected]> wrote: > 'check' variable is a string.actually i need to verify some text in > all the pages.so i wrote a function and pass the text through the > variable "check".i want to use the regular expression for the text as > it is failed in some pages even the particular text is displayed in > page. > > On Dec 2, 2:59 pm, Ethan <[email protected]> wrote: > > > > > String#scan is not really appropriate for just testing whether a string > > matches a regexp (it is certainly possible, but is overkill). the =~ > > operator should suffice: > > > def verify_field(check,result) > > if $ie.text =~ Regexp.new(check) > > $dt.WriteData("#{result}","Sheet1", "Pass") > > else > > $dt.WriteData("#{result}","Sheet1", "Fail") > > end > > end > > > I'm curious if the 'check' variable is a string, or a regexp, though - if > > it's a regexp, you don't need to do Regexp.new; if it's a string, that seems > > like an odd thing to pass in to match as a regexp. maybe you just want > > $ie.text.include?(check) > > > -Ethan > > > On Wed, Dec 2, 2009 at 15:40, John Fitisoff <[email protected]> wrote: > > > try ie.text.scan(regexp) > > > > if ie.text.scan(/foo/).length > 0 > > > ...write some data... > > > end > > > > btw, this isn't a watir issue, it's a ruby issue. IE#text just returns a > > > string and a string's include? method doesn't accept a regex as an > > > argument, > > > at least my installed ruby version doesn't support it. > > > > --- On Wed, 12/2/09, mohe <[email protected]> wrote: > > > > > From: mohe <[email protected]> > > > > Subject: [wtr-general] regular expression in $ie.text.include? issue > > > > To: "Watir General" <[email protected]> > > > > Date: Wednesday, December 2, 2009, 12:22 PM > > > > > regular expression is not working in $ie.text.include?.i am > > > > getting > > > > error message "`include?': can't convert Regexp into > > > > String > > > > (TypeError)" for the following code.any idea please.? > > > > > def verify_field(check,result) > > > > if $ie.text.include?(Regexp.new(check)) > > > > $dt.WriteData("#{result}","Sheet1", "Pass") > > > > else > > > > $dt.WriteData("#{result}","Sheet1", "Fail") > > > > end > > > > end > > > > > -- > > > > You received this message because you are subscribed to the > > > > Google Groups "Watir General" group. > > > > To post to this group, send email to [email protected] > > > > Before posting, please read the following guidelines: > > >http://wiki.openqa.org/display/WTR/Support > > > > To unsubscribe from this group, send email to > > > [email protected] > > > > 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 [email protected] > > > Before posting, please read the following guidelines: > > >http://wiki.openqa.org/display/WTR/Support > > > To unsubscribe from this group, send email to > > > [email protected] > > > For more options, visit this group at > > >http://groups.google.com/group/watir-general-Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "Watir General" group. To post to this group, send email to [email protected] Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/watir-general
