Thursday, January 20, 2011

Web Application Testing in Ruby: How to get frame name from Index

Web Application Testing in Ruby: Frames

print ie.show_frames
---------------------------------------------
frame index: 1 name: leftFrame
frame index: 2 name: topFrame
frame index: 3 name: mainFrame
---------------------------------------------

frameCount = ie.document.frames.length
ar = Array.new(frameCount)
counter = 1

while counter <= frameCount
ar[counter] = ie.frame(:index, counter)
counter = counter + 1
end

I am able to pull info about a specific frame by using ie.frame(:index,
1) but when using this in the loop above I receive the following error:
Unable to locate a frame with name #

This is confusing to me since I am not specifying the name of the frame
but rather the index and I'm not sure why Watir is comparing the names.
I really just need a way to find out how to obtain the name of a frame
using its index.

As always I really appreciate any suggestions or ideas. Thanks!


Are you donig something like this later in the script:

ie.frame( ar[1] )

if so, thats already a watir::frame object

so you probably need

ar[1].button(xxxx).click

No comments:

Post a Comment