Modal dialogs aren't part of a frame, they're generated and owned by ie, so
this line:
ie2.frame("ContentFrame").modal_dialog.text_field(:id,
'FileUploader').set('C:\Users\Public\Pictures\Sample Pictures\Dock.jpg')
should read:
ie2.modal_dialog.text_field(:id,
'FileUploader').set('C:\Users\Public\Pictures\Sample Pictures\Dock.jpg')
-Charley
On 7/6/07, Michael Kernaghan <[EMAIL PROTECTED]> wrote:
Bret Suggested:
>I think the error message may be misleading. I think the problem may
>actually be caused by the use of frames. Can you show us the code that
>is failing?
Certainly. Warts and all here it is:
require 'watir'
require 'win32ole'
include Watir
require 'test/unit'
$how_many = 3
$count = 0
class TC_article_example < Test::Unit::TestCase
def add_new
#Open, login and navigate
ie = IE.new
ie.goto("http:// corporate secrets obscured ")
ie.text_field(:name, "OrgNameTextbox").set("testing")
ie.text_field(:name, "UserNameTextbox").set("testing")
ie.text_field(:name, "PasswordTextbox").set("testing")
ie.button(:name, "LoginButton").click
assert(ie.contains_text("Please select a workspace"))
ie.link( :url, "http:// corporate secrets obscured ").click
ie.link( :text, "Enter Project").click
ie.link( :text, "APPLICATIONS").click
ie.link( :text, "Drawings").click
#Launch and attach new document
ie.button(:value, "New").click
ie2 = Watir::IE.attach(:url, /Drawing/)
#Populate fields
ie2.frame("ContentFrame").text_field(:name,
/V:MainGeneral:SeriesIdentifier:SeriesIdentifierFieldRow:TheTextBox/).set(randomStr(10))
ie2.frame("ContentFrame").text_field(:name,
/V:MainGeneral:DocTitle:DocTitleFieldRow:TheTextBox/).set(randomStr(10))
ie2.frame("ContentFrame").button(:id,
"V_FileInformation_Attachments_SourceFileLink_MyUploadButton").click_no_wait
#Error report cited line follows
ie2.frame("ContentFrame").modal_dialog.text_field(:id,
'FileUploader').set('C:\Users\Public\Pictures\Sample Pictures\Dock.jpg')
#Save and Iterate
allFrames = ie2.getDocument().frames
count = allFrames.length
ie_docFrame = ie2.frame(:name, allFrames.item(count-1).name)
ie_docFrame.button(:id, "V_DocTools_SaveButton_Button").focus
ie_docFrame.button(:id, "V_DocTools_SaveButton_Button").click
$count = $count+1
ie.close
ie2.close
end
def randomStr( len )
chars = ('a'..'z').to_a + ('A'..'Z').to_a + (0..9).to_a
len = rand(len) +1
return (1..len).collect { |i| chars[rand(chars.length),1] }.to_s
end
def test_add_new
while $count < $how_many #Error report cited line
add_new
puts $count
end
end
end
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general