From: Arti Singh on 12 May 2010 13:29 Does anyone know how to determine if an Internet Explorer window has a modal window open using only win32ole? I tried looking in the modal_window.rb and container.rb files in watir but I cant figure how to do this using only win32ole. Any help would be appreciated. -- Posted via http://www.ruby-forum.com/.
From: Darryl Brown on 23 May 2010 22:31 Hi, What version of ruby and watir are you using? The follow snippet works for me. It handles a modal login dialogue followed by a java security popup. def jsClick( a, button, user_inp = nil,rtxt = nil) waitTime = 60 hwnd1 = $ie.enabled_popup(waitTime) # wait up to 60 seconds for a popup to appear if (hwnd1) w = WinClicker.new if (rtxt) popup_text = w.getStaticText_hWnd(hwnd1).to_s.delete "\n" end if (user_inp) w.setTextValueForFileNameField(hwnd1, "#{user_inp}") end sleep 5 w.clickWindowsButton_hwnd(hwnd1, "#{button}") w = nil end return popup_text end ## Modal login using AutoIt def login(site,user,pswd,g) if $Login != 1 a ='Connect to ' + site #login dialogue b = Watir.autoit.WinWait(a,'',60) #login dialogue present? puts" #{a}" if (b==1) #execute only if login dialogue is detected puts " Login\n" Watir.autoit.WinWait(a) Watir.autoit.Send(user) Watir.autoit.Send('{TAB}') Watir.autoit.Send(pswd) Watir.autoit.Send('{ENTER}') sleep 1 c = Watir.autoit.WinWait("Windows Internet Explorer",'',10)# security alert present? if(c==1) g.jsClick($ie,"OK") end $Login = 1 end else puts"Login not required\n" sleep 1 c = Watir.autoit.WinWait("Windows Internet Explorer",'',10) if(c==1) g.jsClick($ie,"OK") end end end On May 12, 1:29 pm, Arti Singh <arti.p.si...(a)hotmail.com> wrote: > Does anyone know how to determine if an Internet Explorer window has a > modal window open using only win32ole? > > I tried looking in the modal_window.rb and container.rb files in watir > but I cant figure how to do this using only win32ole. > > Any help would be appreciated. > -- > Posted viahttp://www.ruby-forum.com/.
|
Pages: 1 Prev: Is Ruby ready to embrace new Linux face and UI realities? Next: Command Line Arguments problem |