[wtr-general] POPUP HANDLING IN WATIR

2012-01-30 Thread AQUA
Hi All, I have been using this above module to handle popup in my WATIR 
tests. what I have seen is it works fine when I call a click_no_wait on my 
submit button. When I try to use fire_event method it doesn't works as 
expected and the execution halts till i manually click the OK button. 
Please help
I am adding a section of the code I m using below

:Doesn't work untill I click the OK button on the dialog box manually
---
$browser.text_field(:id, 'MIR-DV-EFF-DT').set('13-10-2011')
#$browser.text_field(:id, 'MIR-DV-EFF-DT').fire_event(onBlur)
popupMsg = clickprompt(OK,,$browser) 
puts popupMsg

:Works fine and give me a console output Invalid Date format '13-10-2011' 
---
$browser.text_field(:id, 'MIR-DV-EFF-DT').set('13-10-2011') 
$browser.button(:id, 'OKButton').click_no_wait
popupMsg = clickprompt(OK,,$browser)  
puts popupMsg

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


HandlePopUp.rb
Description: Binary data


[wtr-general] popup handling

2010-01-21 Thread Naveen devadass
Hi All,


 I am using following script to handle the pop up

but the code is not woking

the code  autoit.Send({Enter}) is not working .it doesnot  send the
key strokes properly


please help me in this regard

or please give me some other options to handle the pop up
effectively.currently  i am using watir 1.6.2

require 'watir'
 require 'win32ole'
require 'watir/dialog'
require 'watir/winClicker'
require 'watir/contrib/enabled_popup'

# MAIN APPLICATION CODE
link = '\\\hcl0203\Release 3\Automated Testing\popups Handling
\Sampl1.html'

ie = Watir::IE.start(link)
ie.button(:value, 'Click').click


def check_for_popups(title, button)
popup=Thread.new {
autoit=WIN32OLE.new('AutoItX3.Control')
ret=autoit.WinWait(title,,5)
if (ret==1)
autoit.WinActivate(title)
button.downcase!
if button.eql?(ok) || button.eql?(yes) || button.eql?
(continue)
autoit.Send({Enter})
else
autoit.Send({tab})
autoit.Send({Enter})
end
elsif (ret==0)
puts No popup, please check your code.
end
}
at_exit { Thread.kill(popup) }
end

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

[wtr-general] popup handling

2009-03-03 Thread Vikas Tulashyam

Hi friends,
I am getting an error while handling the popup. I have attached the
code and following is the error message��

:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/contrib/
enabled_popup.rb:5: uninitialized constant Watir::PageContainer::Win32
(NameError)
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:31:in `gem_original_require'
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:31:in `require'
from Login.rb:3
Exit code: 1


My code is--


require 'watir'
require 'test/unit'
require 'watir/contrib/enabled_popup'

def startClicker( button , waitTime, user_input=nil )
  # get a handle if one exists
  hwnd = $ie.enabled_popup(waitTime)
  if (hwnd)  # yes there is a popup
w = WinClicker.new
if (user_input )
  w.setTextValueForFileNameField( hwnd, #{user_input} )
end
# I put this in to see the text being input it is not necessary to
work
sleep 3
# OK or whatever the name on the button is
w.clickWindowsButton_hwnd( hwnd, #{button} )
#
# this is just cleanup
w=nil
  end
end

def test_03_TC_RR_003
  $ie.text_field(:name, userName).set()
  $ie.button(:name, Submit).click
   startClicker( Ok , 5)



Please help me if anyone has any idea.

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