[Wtr-general] [Wtr-General] Problem with set_text and dialog boxes

2006-11-22 Thread Howard
I have spent several days debugging to locate a problem with the file open 
dialog box that is presented by an html "file" type.

I am getting a valid handle to the control on the file open dialog, but, when 
winClicker attempts to (ultimately) use set_text, the text is not put into the 
combo box text on the dialog box, and the message is never acknowledged, 
leaving the Open File dialog sitting there.

The code is as follows:

 adoc = $ie.frame("main").image(:src, 
"https://alinea.inmar.com/alinea/images/adddocument.gif";)
sleep 2

adoc.click_no_wait
sleep 2

modal = $ie.modal_dialog
assert_not_nil modal
$path = "C\:\\LogTest.txt"
puts "starting autoit"
$autoit = WIN32OLE.new("AutoItX3.Control") 
sleep 1
ffld = modal.fileField(:name, "selectDoc")
ffld.set($path)
  
success = $autoit.WinWait("Choose file", "", 10)
if success == 0
  puts "Failed to find Choose file"
end
$autoit.WinActivate("Choose file")
$autoit.Send("{TAB 3}{ENTER}")

modal.text_field(:name, "Subject").set("Test Subject")
modal.select_list(:id,"LB1").set("hward")
modal.select_list(:id,"LB1").fire_event("onDblClick")
modal.button(:value, "Add Document").click
sleep 2

modal = $ie.modal_dialog
modal.button(:value, "Close").click

The error message about not finding "Choose file" occurs frequently and the 
autoit code appears to do nothing.  The fields in the modal dialog under the 
File Open will work as long as a file name is manually entered.  I was able, 
one time, to get autoit to push something into the File Name field, but I have 
not been able to get it to work again.

Is there a way to get this process to complete?
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5403&messageID=15064#15064
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] [Wtr-General] Problem with set_text and dialog boxes

2006-11-22 Thread Cain, Mark
If you are using 1.5.1070 or newer (if not you can get it here
http://wiki.openqa.org/display/WTR/Development+Builds) you can use:

 

   require 'watir/contrib/enabled_popup'

   

   $path = "C\:\\watir_bonus\\working\\MyDoc.txt"

 

   def startClicker( button , waitTime=9, user_input=nil)

hwnd = $ie.enabled_popup(waitTime)  # get a handle if one exists 

if (hwnd)  # yes there is a popup

  w = WinClicker.new

  if ( user_input )

w.setTextValueForFileNameField(hwnd, "#{user_input}")

  end

  sleep 3  # I put this in to see the text being input it is not
necessary to work

  w.clickWindowsButton_hwnd(hwnd, "#{button}")  # "OK" or whatever
the name on the button is

  w=nil# this is just cleanup

end

  end

 

  adoc = $ie.frame("main").image(:src,
"https://alinea.inmar.com/alinea/images/adddocument.gif";)

  sleep 2

 

  adoc.click_no_wait

 

  startClicker( '&Open', 9, $path)

 

You may need to tweak this to work in your situation.  I tested this and
it works.

 

--Mark

 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Howard
Sent: Wednesday, November 22, 2006 1:31 PM
To: wtr-general@rubyforge.org
Subject: [Wtr-general] [Wtr-General] Problem with set_text and dialog
boxes

 

I have spent several days debugging to locate a problem with the file
open dialog box that is presented by an html "file" type.

 

I am getting a valid handle to the control on the file open dialog, but,
when winClicker attempts to (ultimately) use set_text, the text is not
put into the combo box text on the dialog box, and the message is never
acknowledged, leaving the Open File dialog sitting there.

 

The code is as follows:

 

 adoc = $ie.frame("main").image(:src,
"https://alinea.inmar.com/alinea/images/adddocument.gif";)

sleep 2

 

adoc.click_no_wait

sleep 2

 

modal = $ie.modal_dialog

assert_not_nil modal

$path = "C\:\\LogTest.txt"

puts "starting autoit"

$autoit = WIN32OLE.new("AutoItX3.Control") 

sleep 1

ffld = modal.fileField(:name, "selectDoc")

ffld.set($path)

  

success = $autoit.WinWait("Choose file", "", 10)

if success == 0

  puts "Failed to find Choose file"

end

$autoit.WinActivate("Choose file")

$autoit.Send("{TAB 3}{ENTER}")

 

modal.text_field(:name, "Subject").set("Test Subject")

modal.select_list(:id,"LB1").set("hward")

modal.select_list(:id,"LB1").fire_event("onDblClick")

modal.button(:value, "Add Document").click

sleep 2

 

modal = $ie.modal_dialog

modal.button(:value, "Close").click

 

The error message about not finding "Choose file" occurs frequently and
the autoit code appears to do nothing.  The fields in the modal dialog
under the File Open will work as long as a file name is manually
entered.  I was able, one time, to get autoit to push something into the
File Name field, but I have not been able to get it to work again.

 

Is there a way to get this process to complete?

-

Posted via Jive Forums

http://forums.openqa.org/thread.jspa?threadID=5403&messageID=15064#15064

___

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

Re: [Wtr-general] [Wtr-General] Problem with set_text and dialog boxes

2006-11-29 Thread Howard
I HAVE FOUND AN ANSWER!  I changed the watir.rb to not use set_text.  Instead, 
I moved the code from set_text to the two places that called it 
(set-combobox-text for one.)  It now works every time.

Debug showed it never actually called the set-text.
-
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5403&messageID=15344#15344
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general