Hi Ethan, I had been working on popups for quite some time and i found that injecting javascript and the autoit methods not good enough.
Injecting javascript - had issues where a popup occurs during page load - these popups couldnt be avoided, cause javscript injection occurs only after the page is loaded. (correct me if iam wrong) Autoit - i had issues with this where i couldnt actually verify that i clicked only on the javascript popup that occured from the webapp under test. Autoit will click on the ok for any popup .. if there are 2 popups from 2 different web apps .. u cannot make sure that the particular popup was clicked. For ie , we can handle popups in a more efficient manner. No need of Autoit or any other external ruby files. I have attached the code to the http://wiki.openqa.org/display/WTR/JavaScript+Pop+Ups?showChildren=true Please take a look at solution 7. This code can be inserted into the ie-class.rb and works by using the ie browser object. Example code - require 'watir' iewin = Watir::IE.new iewin.goto("http://www.w3schools.com/js/tryit_view.asp?filename=tryjs_alert ") iewin.button(:value, "Show alert box").click_no_wait txt = iewin.clickprompt() # waits for popup and click ok puts txt #prints the popup text The advantage of using this is - it will handle any popup from the browser under test only. You can have popups from any other browser and those will not be closed. I havent written the code to handle fileuploads and downloads, but that should be easy. To handle popups during page load .. the above code has to be clubbed with the code at the below url. http://wiki.openqa.org/display/WTR/Security+Alerts - (Autoclick yes when a security alert window pops up?) Bret had previously rejected the above code stating that it would make the wait method more complex. When a popup occurs during a page load .. ie gets stuck in the wait loop, and you will have to exit the wait loop to handle this popup. Hence the use of this line - return 0 if !(popwndtitle.include?("Security Alert") || popwndtitle.include?("Security Information")) It exits if it encounters any other popup other than the Secuirty Alert and Security Information.(which would be handled in the wait loop). Thanks, Tony
_______________________________________________ Wtr-development mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-development
