Also need to use click_no_wait method? I have told you that this method would not make the popup menu out,i don't know why.(there is a yelloa shadow on the button which show it attemp to do the click behavior),so anyother good advise? If you have a google talk ID,please join me ,I'm very boring for this and get embarrassment.Thanks!(my ID:[email protected])
On Apr 16, 10:56 pm, bwaybandit <[email protected]> wrote: > This below will handle yoru javascript/vbscript popups. If they are > native window popups then you have to resort to autoit > > require 'watir/ie' > require 'watir/contrib/enabled_popup' > > # Main method to click a modal dialog button. > def click_modal_button(ie, type='OK', sleep_time=6, timeout=20) > hwnd = ie.enabled_popup(sleep_time) > if (hwnd) > w = WinClicker.new > w.clickWindowsButton_hwnd( hwnd, "#{type}") > w=nil > end > end > > ie=Watir::Browser.new > ie.goto "C:\\test.html" > ie.button(:name, 'cmdClickMe').click_no_wait > click_modal_button(ie) > > On Apr 16, 6:37 am, William <[email protected]> wrote: > > > > > I still can not make it.If you have some good way to handle javascript > >popupmenu,please show me,thanks very much! > > > On Apr 15, 9:54 pm, bwaybandit <[email protected]> wrote: > > > > a little confusion here. > > > > 1. when you use click_no_wait, do you see apopupand if you do, your > > > code is not handing it, is that right? (reason i ask is because your > > > initial comment was you could not see thepopup?) > > > > 2. in jsClick, you can remove the second parameter, since it is not > > > being used at all. > > > > 3. When you are calling jsClick the third parameter does not render in > > > ie or google, so not sure what you are passing in. Should be something > > > like 'OK', 'Cancel'. etc Once you fix that, it should handle your > > >popup > > > > On Apr 15, 9:33 am, William <[email protected]> wrote: > > > > > Here is the method i handle thepopupmenu,maybe you can give some > > > > advise. > > > > > def jsClick( ie,a, button, user_input=nil) > > > > waitTime=30 > > > > hwnd = ie.enabled_popup(waitTime) > > > > puts hwnd > > > > if (hwnd) > > > > w = WinClicker.new > > > > if ( user_input ) > > > > w.setTextValueForFileNameField(hwnd, "#{user_input}") > > > > end > > > > sleep 3 > > > > w.clickWindowsButton_hwnd(hwnd, "#{button}") > > > > w=nil > > > > end > > > > end > > > > > def reboot(ie,unit_url,type) > > > > ie.maximize() > > > > ie.goto unit_url > > > > ie.text_field(:name,"user").set "admin" > > > > ie.text_field(:name,"pass").set "admin" > > > > ie.button(:id,"login").click > > > > case type > > > > when 2 then > > > > begin > > > > ie.link(:url,unit_url+"/cgi-bin/config").click > > > > end > > > > when 5 then > > > > begin > > > > ie.link(:url,unit_url+"/config_tn.htm").click > > > > end > > > > end > > > > sleep 3 > > > > ie.button(:id,"reboot").click_no_wait > > > > puts "clicked" > > > > #ie.button(:id,"reboot").click > > > > jsClick(ie,@ie, "确定") > > > > puts "The system("+unit_url+") is going to reboot..." > > > > end > > > > > On Apr 15, 9:30 pm, William <[email protected]> wrote: > > > > > > yes,if I use "click" it wouldpopup,but if i use this method i that it > > > > > can not handle the javascriptpopupframe in my test. > > > > > > On Apr 15, 9:01 pm, bwaybandit <[email protected]> wrote: > > > > > > > Does thepopupappear when you use just "click"? > > > > > > > On Apr 15, 7:14 am, William <[email protected]> wrote: > > > > > > > > The html is "<a name="reboot" id="reboot" class="myAreaLink" > > > > > > > onclick="cb_reboot();"> > > > > > > > Reboot</a>" > > > > > > > > and i use " ie.button(:id,"reboot").click_no_wait" but > > > > > > > thepopupframe > > > > > > > can not come out.- Hide quoted text - > > > > > > > - Show quoted text -- Hide quoted text - > > > > > > - Show quoted text -- Hide quoted text - > > > > - Show quoted text -- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
