Hello Aami..,

I was not able to reach the site - ('http://www.irctc.co.in/').
However, here is a method that works for me
at the Google site:

***********************************************************************************************
require 'test/unit'
require 'watir/ie'
require 'win32ole'
require 'watir\contrib\enabled_popup'

def jsClick( a, button, user_input=nil)
 waitTime=30
 hwnd = $ie.enabled_popup(waitTime)
 puts("wait time = 30")
  if (hwnd)
  puts("if = hwnd")
    w = WinClicker.new
   if ( user_input )
   puts("if = user input")
     w.setTextValueForFileNameField(hwnd, "#{user_input}")
   end
   sleep 3
   puts ("CLICK THE BUTTON")

    w.clickWindowsButton_hwnd(hwnd, "#{button}")
    w=nil
 end
end

   test_site = "http://www.google.com/preferences?hl=en";
   $ie = Watir::IE.new
   $ie.goto test_site
   $ie.maximize()
   $ie.radio(:id,"slc").set
    $ie.button(:name,"submit2").click_no_wait
        sleep 5
   jsClick( $ie, "OK")

   jsClick( $ie, "OK")


        # The popup click works when jsClick is called twice, the first click
        # just highlights the popup box. The second click does the trick
        #
***************************************************************************************************

Regards,

Darryl


On Dec 31, 12:21 am, [email protected] wrote:
> I am trying to run the below script but getting an error. Can anyone
> help me on this? I want to bypass the javascript popup. Thanks in
> advance.
> The script below:
> require 'watir'
> include 'watir'
> #require 'watir/contrib/enabled_popup'
> require 'test/unit'
> class TC_recorded < Test::Unit::TestCase
>         def test_recorded
>                 ie = Watir::IE.new
>         ie.goto('http://www.irctc.co.in/')
>         ie.text_field(:name, 'userName').set('aamittt')
>         ie.button(:id, 'Button1').click
>   hwnd = browser.enabled_popup(5)
> if (hwnd)  #yeah! a popup
>   popup = WinClicker.new
>   popup.makeWindowActive(hwnd)
>   popup.clickWindowsButton("Windows Internet Explorer", "OK", "30")
> end
>         end
> end
>
> Iam getting following error:
> 1) Error:
> test_recorded(TC_recorded):
> NameError: undefined local variable or method `browser' for
> #<TC_recorded:0x2c7d3e4>
>     exam1.rb:10:in `test_recorded'

On Dec 31 2008, 12:21 am, [email protected] wrote:
> I am trying to run the below script but getting an error. Can anyone
> help me on this? I want to bypass the javascript popup. Thanks in
> advance.
> The script below:
> require 'watir'
> include 'watir'
> #require 'watir/contrib/enabled_popup'
> require 'test/unit'
> class TC_recorded < Test::Unit::TestCase
>         def test_recorded
>                 ie = Watir::IE.new
>         ie.goto('http://www.irctc.co.in/')
>         ie.text_field(:name, 'userName').set('aamittt')
>         ie.button(:id, 'Button1').click
>   hwnd = browser.enabled_popup(5)
> if (hwnd)  #yeah! a popup
>   popup = WinClicker.new
>   popup.makeWindowActive(hwnd)
>   popup.clickWindowsButton("Windows Internet Explorer", "OK", "30")
> end
>         end
> end
>
> Iam getting following error:
> 1) Error:
> test_recorded(TC_recorded):
> NameError: undefined local variable or method `browser' for
> #<TC_recorded:0x2c7d3e4>
>     exam1.rb:10:in `test_recorded'

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to [email protected]
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to