> Sun, > > If the window only has the title "Internet Explorer" > then it's not likely that it's a modal dialog. This sounds more > like an IE warning dialog, which is quite different. > > I cannot duplicate that warning box on my copy of IE, > probably because I previously unchecked the box in the warning so I > wouldn't see it again. > > Here are some ways you should be able to proceed: > > First, run the same series of events manually in IE. > When you get the popup after clicking the "Google Search" button see > if there is a checkbox you can uncheck so that warning will no > longer pop up. Then you won't have to handle it at all.
Yes...the problem I have is that I have a corporate browser. I have in fact "checked" this so that it should not reappear but it does anyway. Corporate IT doesn't let us change the security levels for the browser so...that is probably why the popups are forced. > Second, here is how I've handled that type of popup > before: > > # Change the click to click_no_wait so that any popup > won't block Watir > ie.button(:name, "btnG").click_no_wait > > hwnd = ie.enabled_popup( 10 ) # wait up to 10 seconds > for a popup to appear > if( hwnd ) # there is a popup of some kind. > if( ie2 = ie.modal_dialog(:hwnd, hwnd) ) # if it's a > modal dialog > ie2... # do normal Watir stuff on the modal dialog > else > wc = WinClicker.new > wc.clickWindowsButton_hwnd(hwnd, "OK") # close > non-modal popup with > Handle=hwnd > end > end > > David Schmidt > OK, thank you for the suggestion. I have implemented it. Problem now is, I get this message: undefined method `enabled_popup' for #<Watir::IE:0x2c61aa4> Presumably I am missing a library somewhere? I should be requiring something that I am not? But as I mentioned in the base note, I have installed the current Ruby (1.8.4-20 stable), and the development gem for Watir (watir-1.5.1.1065.gem) so...here is the complete script text (which I am running in freeride): === # # demo test for the WATIR controller # # Simple Google test written by Jonathan Kohl 10/10/04 # Purpose: to demonstrate the following WATIR functionality: # * entering text into a text field # * clicking a button # * checking to see if a page contains text. # Test will search Google for the "pickaxe" Ruby book # #- require 'watir' # the watir controller # Main application code follows # # set a variable test_site = 'http://www.google.com' # open the IE browser ie = Watir::IE.new # print some comments puts "## Beginning of test: Google search" puts " " puts "Step 1: go to the test site: " + test_site ie.goto(test_site) puts " Action: entered " + test_site + " in the address bar." # Added flashes... ie.text_field(:name, "q").flash ie.button(:value, "Google Search").flash puts "Step 2: enter 'pickaxe' in the search text field" ie.text_field(:name, "q").set("pickaxe") # q is the name of the search field puts " Action: entered pickaxe in the search field" #Ensure popup won't block Watir ie.button(:name, "btnG").click_no_wait puts "Step 3: click the 'Google Search' button" ie.button(:name, "btnG").click # "btnG" is the name of the Search button puts " Action: clicked the Google Search button." #Handle the popup hwnd = ie.enabled_popup(5) if (hwnd) #yes there is a popup if (modal = ie.modal_dialog(:hwnd, hwnd)) #and if it is modal puts(modal.to_s) modal.button(:value, "Yes").click else wc = WinClicker.new wc.clickWindowsButton_hwnd(hwnd, "OK") #close nonmodal popup via handle end end puts "Expected Result: " puts " - a Google page with results should be shown. 'Programming Ruby' should be high on the list." puts "Actual Result: Check that the 'Programming Ruby' link appears on the results page " if ie.contains_text("Programming Ruby") puts "Test Passed. Found the test string: 'Programming Ruby'. Actual Results match Expected Results." else puts "Test Failed! Could not find: 'Programming Ruby'" end puts " " puts "Exit" # -end of simple Google search test === Note that if I put the popup handler in front of "Step 3" the results are identical, it is just that it hangs before step 3 instead of after it. Question -- where would the "enabled_popup" method be located? Isn't this in the watir development gem? --------------------------------------------------------------------- Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=4012&messageID=11241#11241 _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
