If the methods above can't work, you can try the one below. # When it displays the "OKCancel" or "OK" pop up, it will click it def popup_clicker(ie = $ie, buttonname= "OK") require 'watir/contrib/enabled_popup' hwnd = ie.enabled_popup(15) if(hwnd) #yeah! a popup popup = WinClicker.new popup.makeWindowActive(hwnd) #Activate the window. popup.clickWindowsButton_hwnd(hwnd,buttonname) #Click the button # #popup.clickWindowsButton(/Internet/,buttonname,30) popup=nil end end
sth.click_no_wait popup_clicker($b, "OK") I submit the one you referred, but I don't know why sometimes it works, sometimes it doesn't. Maybe in the second, it works, in the next second, it doesn't work. For the popup_clicker, I think it is a stable one. Thanks. Wesley Chen. For life, the easier, the better. On Fri, Jan 22, 2010 at 1:37 AM, orde <ohil...@gmail.com> wrote: > I think you need to use click_no_wait on this line: > > ie.button(:value, 'Click').click > > Also, lots of info here: http://wiki.openqa.org/display/WTR/Pop+Ups > > Hope it helps... > > orde > > > On Jan 21, 9:28 am, Naveen devadass <naveeenku...@gmail.com> wrote: > > 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 > -- 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