I've got everything connecting to the frames now that was awesome!!! One
more thing, can you point me to the lines that Attach to browsers?  If I can
get that final step I think I'll be good to go! :D

Mike

On Wed, Aug 17, 2011 at 3:09 PM, Ethan <[email protected]> wrote:

> if you have a WIN32OLE representing a <frame> or <iframe> you can get its
> window and document via:
>
> frame_window = frame_ole_object.contentWindow
> frame_document = frame_window.document
>
>
> On Wed, Aug 17, 2011 at 14:14, Michael Mattera <[email protected]>wrote:
>
>> I bypass the WIN32OLERuntimeError so I'm about to access the frame's
>> properties and the frame's name etc.  However when I try to get the document
>> it just returns me the main browser document, not the frame document.
>>
>> I've tried reading through those files Jarmo but like I said I'm new to
>> ruby and I get a little confused.  I'm trying to find out how given a
>> browserObject.Document.frame I can get the
>> browserObject.Document.frame.document so I can access those controls.
>>
>> I'll paste some of my personal source code to see if you guys can maybe
>> give me a simple breakdown of what I'm missing.
>>
>>                      ["FRAME", "IFRAME"].each do |frame_tag|
>>  frames = @ie.Document.getElementsByTagName(frame_tag)
>>  frames.each do |frame|
>>  frame_document = get_frame_document(frame)
>>
>> control = find_control_for_document(filter_expression, frame_document)
>>
>> if(control != nil)
>> return control
>> end
>>  end
>> end
>>
>> this is very similar to your loop that I found to get every frame in a DOM
>> document.
>>
>> def get_frame_document(frame)
>> document = nil
>>
>> begin
>> document = frame.Document
>> rescue WIN32OLERuntimeError => e
>>  end
>>
>> return document
>> end
>>
>> this function returns me the frame's document.
>>
>> However when I try to access the DOM of that document I just get the
>> original document's DOM not the Frame's...so I can never see the controls
>> inside of the frame.  I'm not sure how you guys wire up the frame object and
>> the container to get around this
>>
>> On Wed, Aug 17, 2011 at 12:47 PM, Jarmo <[email protected]> wrote:
>>
>>> What is the WIN32OLERuntimeError you're getting? Is it access denied? In
>>> that case read "Why do I get an access denied error when trying to access a
>>> frame?" in wiki at http://wiki.openqa.org/display/WTR/Frames Maybe that
>>> helps.
>>>
>>> All the relevant source code is visible at
>>> https://github.com/bret/watir/blob/master/watir/lib/watir/frame.rb#L9-21
>>>
>>> https://github.com/bret/watir/blob/master/watir/lib/watir/container.rb#L117-121
>>>  and
>>> https://github.com/bret/watir/blob/master/watir/lib/watir/locator.rb#L107-145
>>>
>>> Jarmo
>>>
>>>
>>> On Wed, Aug 17, 2011 at 5:59 PM, Michael Mattera <[email protected]
>>> > wrote:
>>>
>>>> Hi,
>>>>
>>>>    I'm new to Ruby and I'm curious as to how Watir uses the WIN32OLE to
>>>> connect to the DOM inside a Frame.  I have been able to get the frame
>>>> ReadyState by ignoring the WIN32OLERuntimeError however I can not access
>>>> controls inside of that frame.
>>>>
>>>>    All I can find online is about how to code a Watir test to see
>>>> frames, but I want to know how it works behind the scenes.  Being new to
>>>> Ruby I only understand so much from the Watir source code, I was hoping
>>>> someone could give me a good explanation on how to recreate this.
>>>>
>>>> Mike
>>>>
>>>> _______________________________________________
>>>> Wtr-development mailing list
>>>> [email protected]
>>>> http://rubyforge.org/mailman/listinfo/wtr-development
>>>>
>>>
>>>
>>> _______________________________________________
>>> Wtr-development mailing list
>>> [email protected]
>>> http://rubyforge.org/mailman/listinfo/wtr-development
>>>
>>
>>
>> _______________________________________________
>> Wtr-development mailing list
>> [email protected]
>> http://rubyforge.org/mailman/listinfo/wtr-development
>>
>
>
> _______________________________________________
> Wtr-development mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/wtr-development
>
_______________________________________________
Wtr-development mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-development

Reply via email to