Thanks, Mark and Michael. I'm glad to have the frame handle business explained. Unfortunately, the text is still not being found at either the frame level or the browser level.
If I look for text (using xx.text.include?) at the browser level, should I expect it to be found regardless of the presence of other structures, like frames or tables? In other words, if the text is present inside of a frame, should I have to search using the frame handle or should a browser level search find the text as well? On Jan 27, 12:24 pm, "Mark Anderson" <[email protected]> wrote: > > 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- 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 -~----------~----~----~----~------~----~------~--~---
