I use this and have no problems clicking a popup:

 

    def startClicker( button , waitTime = 3)

      w = WinClicker.new

      longName = $ie.dir.gsub("/" , "\\" )

      shortName = w.getShortFileName(longName)

      c = "start rubyw #{shortName }\\watir\\clickJSDialog.rb #{button } #{ waitTime} "

      puts "Starting #{c}"

      w.winsystem(c)

      w=nil

      #assert_same(expected, actual, [message] ) #Expects expected.equal?(actual)

    end

 

 

   def test_SomeTest

     code for this test

    

      …

    

     # start the click just before the popup is invoked.

     startClicker("OK" , 3)

     $ie.button("Submit").click

    

   end

 

Hope this helps,

 

--Mark


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Vishal Chavan
Sent: Saturday, October 15, 2005 1:35 PM
To: [email protected]
Subject: [Wtr-general] Unable to get handle for the Window During firstexecution.

 

HI,

I have following code which fails to recognize the Popup for the first execution, but if I try re-executing my script keeping both the initial browser windows open..it strangely works. Please advice as to where I am going wrong? Here is my code..

require 'watir'
require 'test/unit'
require 'watir/winClicker'


ie = Watir::IE.start("http://www.formsite.com/forms/autoresponder/")
w = WinClicker.new
handle = w.getWindowHandle("Microsoft Internet Explorer")
ie.button(:value, "Submit").click
ie.image(:src, /qbut/).click

ie1 = Watir::IE.attach(:title, "Instructions")


handle = w.getWindowHandle("Microsoft Internet Explorer")
ie1.text_field(:name, "ItemInstructions").clear
ie1.button(:value, "Close").click

ie.close

Thanks,

Vishal

 


 


Join SQAtester.com Community ---> http://www.sqatester.com/testersarea/joinus.htm

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to