> I was trying this just as a debug step because an 'ie.text.include?' > is not finding the text that I want it to. There are six frames in > the page and I was trying to verify that the focus was on the one that > contained the text... > > What I want Watir to find is FIND THIS TEXT in the following HTML > code. > > <TR ID="t_3_FNHR"><TD style="HEIGHT:3.18mm" class="a26" > style="background-color:Beige;"><DIV class="r11">C7654321 </ > DIV></TD><TD class="a27" style="background-color:Beige;"><DIV > class="r11">29153207 </DIV></TD><TD class="a28" > style="background-color:Beige;"><DIV class="r11">John Q Public</DIV></ > TD><TD class="a29" style="background-color:Beige;"><DIV > class="r11">09/13/2008</DIV></TD><TD class="a30" style="background- > color:Beige;"><DIV class="r11">09/17/2008</DIV></TD><TD class="a31" > style="background-color:Beige;"><DIV class="r11">FIND THIS TEXT</DIV></ > TD><TD class="a32" style="background-color:Beige;"><DIV > class="r11">8110</DIV></TD><TD class="a33" style="background- > color:Beige;"><DIV class="r11">09/17/2008</DIV></TD><TD class="a34" > style="background-color:Beige;"><DIV class="r11">Re-Open</DIV></TD><TD > class="a35" style="background-color:Beige;"><DIV class="r11">Santa Fe</ > DIV></TD></TR> > > The following Watir code says it isn't found: > > ie.frame(:name,"NameOfFrame") > if ie.text.include? 'FIND THIS TEXT' > puts " FIND THIS TEXT Found" > else > puts " FIND THIS TEXT Not Found" > end > > I'm trying this for each of the six frames. I don't know if the > ie.frame command should be necessary or not (or even if it's actually > bringing focus to the frame).
I think the code you are looking for is: if ie.frame(:name, "NameOfFrame").text.include? 'FIND THIS TEXT' puts " FIND THIS TEXT Found" else puts " FIND THIS TEXT Not Found" end When you are calling ie.frame(:name,"NameOfFrame"), it is returning a handle to the frame, but you aren't using that handle. You are going back to the browser level to look at text, so you are looking in the same place 6 times. If you wanted to use the handle you are getting you could use: name_of_frame = ie.frame(:name,"NameOfFrame") if name_of_frame.text.include? 'FIND THIS TEXT' puts " FIND THIS TEXT Found" else puts " FIND THIS TEXT Not Found" end __________ Information from ESET NOD32 Antivirus, version of virus signature database 3804 (20090127) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---