Hi Gary, Since you are starting a new thread for handling pop up. The text that you are sending to console will not be available to you. Also the captureText that you are writing won't be able to help you because the pop up will already be closed by start_js_clicker.
If you look at the file 'jscriptextralert.rb' which you are calling in thread in function start_js_clicker, it creates new instance of WindowHelper class and then call function push_alert_button. Now in file 'watir/windowhelper.rb' go to function push_alert_button function, in that function you write the functionality to capture the text. In that function you can open a file, write the text of pop up to that file. Now instead of calling 'captureText', open the file and read text from that file. Hope this helps. You can go through following threads for more information. http://rubyforge.org/pipermail/wtr-general/2007-April/010466.html http://rubyforge.org/pipermail/wtr-general/2007-April/010512.html http://rubyforge.org/pipermail/wtr-general/2007-April/010523.html - Angrez On 5/15/07, gary <[EMAIL PROTECTED]> wrote:
OK, now here's the latest update. Once again any help would be greatly appreciated as I'm having difficulty in extracting the text from an alert. Coming from a qa background rather than developer, I feel like a fish out of watir. Anyway, I've figured out how to deal with the script halting part way through but now I am no longer getting the text in the alert but a '1' instead: 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 captureText autoit = WIN32OLE.new('AutoItX3.Control') ret = autoit.WinWait "Windows Internet Explorer", "", 1 text = autoit.WinGetText "Windows Internet Explorer" puts text.to_s autoit.Send "{ENTER}" end def start_jsalert_clicker Thread.new{ system("ruby \"C:\\ruby\\lib\\ruby\\gems\\1.8\\gems\\watir- 1.5.1.1164\\unittests\\jscriptExtraAlert.rb\"") } end def test_1 @IE0 = IE.new @IE0.set_fast_speed @IE0.goto("www.hmv.co.uk") @IE0.link(:text, "Sign In").click start_jsalert_clicker @IE0.image(:alt, "continue").click captureText @IE0. close 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