Re: [Wtr-general] Modal Dialog/Vista -- undefined method `hwnd'

2007-07-06 Thread Charley Baker

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
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

[Wtr-general] Modal Dialog/Vista -- undefined method `hwnd'

2007-07-06 Thread Michael Kernaghan
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/).se
t(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
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Modal Dialog/Vista -- undefined method `hwnd'

2007-07-05 Thread Bret Pettichord
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?

Bret

Michael Kernaghan wrote:
>
> Interesting.
>
> I think I have worked out my understanding problems but now I get this 
> problem. Maybe I need an older rev of Ruby 1.8.2?
>
> / Environment  /
>
> Ruby 1.8.2-15
>
> MS Vista
>
> watir-1.5.1.1166
>
>  Error Message 
>
> NoMethodError: IE#modal_dialog not supported with the current version 
> of Ruby (1.8.2).
>
> See http://jira.openqa.org/browse/WTR-2 for details.
>
> undefined method `hwnd' for #
>
> c:/ruby182/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:2815:in 
> `initialize'
>
> c:/ruby182/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:351:in 
> `new'
>
> c:/ruby182/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:351:in 
> `modal_dialog'
>
> Michael Kernaghan
>
> Quality Control Tester
>
> Meridian Systems
>
> [EMAIL PROTECTED] 
>
> 604-609-0833 #103
>
> * *
>
> *Read what IDC believes to be the key to the success of engineering, 
> construction & RE industries. *
>
> IDC Analyst Connection “Integrated Project and Portfolio Management: 
> Improving Efficiency, Lowering Risk
>
> for Engineering, Construction and Real Estate Firms” Visit 
> www.meridiansystems.com/performance 
> 
>
> 
>
> ___
> Wtr-general mailing list
> Wtr-general@rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


[Wtr-general] Modal Dialog/Vista -- undefined method `hwnd'

2007-07-05 Thread Michael Kernaghan
Interesting.

 

I think I have worked out my understanding problems but now I get this
problem. Maybe I need an older rev of Ruby 1.8.2?

 

 Environment 

 

Ruby 1.8.2-15

MS Vista

watir-1.5.1.1166

 

 Error Message 

 

NoMethodError: IE#modal_dialog not supported with the current version of
Ruby (1.8.2).

See http://jira.openqa.org/browse/WTR-2 for details.

undefined method `hwnd' for #

 
c:/ruby182/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:2815:in
`initialize'

c:/ruby182/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:351:in
`new'

c:/ruby182/lib/ruby/gems/1.8/gems/watir-1.5.1.1166/./watir.rb:351:in
`modal_dialog'

 

 

Michael Kernaghan

Quality Control Tester

Meridian Systems

[EMAIL PROTECTED]  

604-609-0833 #103

 

Read what IDC believes to be the key to the success of engineering,
construction & RE industries.

IDC Analyst Connection "Integrated Project and Portfolio Management:
Improving Efficiency, Lowering Risk 

for Engineering, Construction and Real Estate Firms"   Visit
www.meridiansystems.com/performance
  

 

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general