Hi everyone,
I'm having difficulty in capturing the text from a java alert, and would
appreciate anyones input.
Using AutoIT, for the pop up window works a treat, allowing me to capture the
text, and then select the OK button to proceed with the script:
require 'watir' # the controller
include Watir
require 'watir/WindowHelper'
require 'test/unit'
require 'test/unit/ui/console/testrunner'
require 'dl/win32'
class TC_recorded < Test::Unit::TestCase
def check_for_popups
autoit = WIN32OLE.new('AutoItX3.Control')
loop do
sleep(3)
ret = autoit.WinWait('Security Information', '', 1)
text = autoit.WinGetText('Security Information', '')
if (ret==1)
puts text
else
puts "where is it?"
end
if (ret==1) then autoit.Send('{Yes}') end
sleep(2)
end
end
def test_1
@IE0 = IE.new
@IE0.set_fast_speed
@IE0.goto("http://hmvdigital.co.uk/HMV.Digital.OnlineStore.Portal/Pages/Home.aspx")
@IE0.link(:text, "Sign in").click
@popup = Thread.new { check_for_popups } # start popup handler
@IE0.link(:href,
"https://hmvdigital.co.uk/HMV.Digital.OnlineStore.Portal/Pages/HelpPopup.aspx?category=Managing_your_account&link=AboutRememberMe").click
Thread.kill(@popup) # end popup handler
@IE0.close
end
end
Unfortunately I have been unable to use AutoIt in dealing with an alerts, and
have been using winClicker. I am able to select the OK button to proceed, but
unable to capture any text:
require 'watir' # the controller
include Watir
require 'watir/WindowHelper'
require 'test/unit'
require 'test/unit/ui/console/testrunner'
require 'dl/win32'
require 'watir/winClicker'
class TC_recorded < Test::Unit::TestCase
def startClicker( button , waitTime = 3)
w = WinClicker.new
longName = @IE0.dir.gsub("/" , "\\" )
shortName = w.getShortFileName(longName)
c = "start ruby #{shortName }\\watir\\clickJSDialog.rb #{button } #{waitTime}
"
puts "Starting #{c}"
w.winsystem(c)
w=nil
end
def test_1
@IE0 = IE.new
@IE0.set_fast_speed
@IE0.goto("www.hmv.co.uk")
@IE0.link(:text, "Sign In").click
startClicker("OK" , 3)
@IE0.image(:alt, "continue").click
@IE0.close
end
end
As previously mentioned, any help would be greatly appreciated, many thanks....
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general