If you RTSL a bit you'll see that calling browser.frame creates a new element but doesn't validate it actually found anything. When you call the html method it first asserts that the object exists and throws an exception if not.<div>
<br></div><div>The located=false comes from the element#inspect method, (which just taught me a new Ruby idiom: !!@o returns true if @o is a valid object or false if it isn't.) So located=false means that the object never existed, nor will it ever.</div>
<div><br></div><div>While poking around I saw a locate_frame method. Maybe that might work better? (It's actually possible that .frame uses locate_frame, I didn't trace it far enough)</div><div><br></div><div>Failing that, what about opening the frame directly?</div>
<div><br></div><div>Sean</div><div><br></div><div><br><br><div class="gmail_quote">On Tue, Apr 20, 2010 at 12:05 PM, Dan Martin <span dir="ltr"><<a href="mailto:ummar143@shaw.ca">ummar143@shaw.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div style="word-wrap:break-word">As noted in the previous email<div><div class="im"><div>>> browser.frame("main")</div>
<div>=> #<FireWatir::Frame:0x1a90dd4 located=false how=:name what="main"></div><div><br></div></div><div>"located=false" seems to be Firewatir's way of saying that the object doesn't exist until I ask for it.</div>
<div>If I try to use it anyway, I get an unknown object exception</div><div><br></div><div><div>>> browser.frame("main").html</div><div>Watir::Exception::UnknownObjectException: Unable to locate element, using :name, "main"</div>
<div><span style="white-space:pre">        </span>from /Library/Ruby/Gems/1.8/gems/firewatir-1.6.5/lib/firewatir/element.rb:907:in `assert_exists'</div><div><span style="white-space:pre">        </span>from /Library/Ruby/Gems/1.8/gems/firewatir-1.6.5/lib/firewatir/elements/frame.rb:34:in `html'</div>
<div><span style="white-space:pre">        </span>from (irb):62</div><div><br></div></div><div><div></div><div class="h5"><div><div>On 20-Apr-10, at 11:34 AM, Sean Walberg wrote:</div><br><blockquote type="cite"><div><br></div>Looking at the rdocs, <a href="http://wtr.rubyforge.org/rdoc/1.6.5/" target="_blank">http://wtr.rubyforge.org/rdoc/1.6.5/</a>, have you tried<div>
<br></div><div>browser.frame("main").html</div><div><br></div><div> ?<br><br><div class="gmail_quote">On Tue, Apr 20, 2010 at 10:51 AM, Dan Martin <span dir="ltr"><<a href="mailto:ummar143@shaw.ca" target="_blank">ummar143@shaw.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> I am learning to navigate and scrape. I have had more success with<br> Firewatir than Ruby mechanize, but both are poorly documented.<br>
<br> Current problem: logging into a site webpage, Firwatir can see the<br> frames, but cannot access them.<br> <br> >> browser.show_frames<br> There are 3 frames<br> frame: name: topbar<br> index: 1<br> frame: name: langFrame<br>
index: 2<br> frame: name: main<br> index: 3<br> => 0..2<br> <br> >> browser.frame(:index, 1)<br> => #<FireWatir::Frame:0x1a9260c located=false how=:index what=1><br> <br> >> browser.frame("main")<br>
=> #<FireWatir::Frame:0x1a90dd4 located=false how=:name what="main"><br> <br> Firefox shows the webpage source [I show only the top levels]<br> structure as:<br> <br> <html><br> <br> <head><br>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1"><br> <title>TITLE</title><br> <link rel="stylesheet" href="all.css"><br>
<br> <script language="JavaScript" src="WEBPAGE"></script><br> <script language="JavaScript">FUNCTIONS</script><br> </head><br> <br> <frameset rows="63,0,*" border="0" id="frameset_ID" framespacing="0"<br>
frameborder="no" onload="loadHomepage(1);" onunload="forceLogout();"><br> <frame src="/TDM/header.htm" name="topbar" scrolling="no"<br> noresize>STUFF IN HERE</frame><br>
<br> <frame name="langFrame" src="lang.html">STUFF IN HERE</frame><br> <frame src="" id="main_ID" name="main" noresize>STUFF IN HERE THAT I<br>
WANT</frame><br> </frameset><br> <br> <noframes><br> STUFF IN HERE<br> </noframes><br> <br> </html><br> <br> <br> I cannot access any forms etc included in the frame unless I can<br>
name / access the frame.<br> Any ideas?<br> <br> Dan Martin<br> GP Hospital Practitioner<br> Computer Scientist<br> <a href="mailto:ummar143@shaw.ca" target="_blank">ummar143@shaw.ca</a><br> (204) 831-1746<br> answering machine always on<br>
<br> _______________________________________________<br> Roundtable mailing list<br> <a href="mailto:Roundtable@muug.mb.ca" target="_blank">Roundtable@muug.mb.ca</a><br> <a href="http://www.muug.mb.ca/mailman/listinfo/roundtable" target="_blank">http://www.muug.mb.ca/mailman/listinfo/roundtable</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Sean Walberg <<a href="mailto:sean@ertw.com" target="_blank">sean@ertw.com</a>> <a href="http://ertw.com/" target="_blank">http://ertw.com/</a><br> </div> _______________________________________________<br>
Roundtable mailing list<br><a href="mailto:Roundtable@muug.mb.ca" target="_blank">Roundtable@muug.mb.ca</a><br><a href="http://www.muug.mb.ca/mailman/listinfo/roundtable" target="_blank">http://www.muug.mb.ca/mailman/listinfo/roundtable</a><br>
</blockquote></div><br><div> <span style="font-size:12px"><div style="word-wrap:break-word"><span style="border-collapse:separate;color:rgb(0, 0, 0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="word-wrap:break-word">
<div>Dan Martin</div><div><div style="word-wrap:break-word"><div style="word-wrap:break-word"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">GP Hospital Practitioner</div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">
Computer Scientist</div><div><a href="mailto:ummar143@shaw.ca" target="_blank">ummar143@shaw.ca</a></div><div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">(204) 831-1746</div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">
answering machine always on</div></div></div></div></div></div></span></div></span> </div><br></div></div></div></div><br>_______________________________________________<br>
Roundtable mailing list<br>
<a href="mailto:Roundtable@muug.mb.ca">Roundtable@muug.mb.ca</a><br>
<a href="http://www.muug.mb.ca/mailman/listinfo/roundtable" target="_blank">http://www.muug.mb.ca/mailman/listinfo/roundtable</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Sean Walberg <<a href="mailto:sean@ertw.com">sean@ertw.com</a>> <a href="http://ertw.com/">http://ertw.com/</a><br>
</div>