From jared at kilmore.info Thu Jul 2 09:39:46 2009 From: jared at kilmore.info (Jared Quinert) Date: Thu, 02 Jul 2009 23:39:46 +1000 Subject: [Wtr-development] Running scripts against Watir and Celerity Message-ID: <4A4CB8A2.7070204@kilmore.info> I posted questions a while back about having a Celerity-style driver for Watir. I've got an interim solution, which also helps me solve/work around issues in differences in behaviour between different Watir drivers. It doesn't give me a native 'browserless' solution running on Windows, but it does at least let me run the same scripts using Watir/Ruby-Win32 and Celerity/JRuby. Anyway, I've documented my first-cut, rough solution on my blog at http://www.software-testing.com.au/blog/index.php?itemid=88. I'd be happy to have feedback, and hopefully it helps someone. Jared http://www.software-testing.com.au/blog/ From ynot408 at gmail.com Mon Jul 13 05:20:00 2009 From: ynot408 at gmail.com (! Tony !) Date: Mon, 13 Jul 2009 14:50:00 +0530 Subject: [Wtr-development] Added support for handling security popups when loading a page Message-ID: <8ac3ceb30907130220v2d27513dp13d6a99c6d21c9b2@mail.gmail.com> Hi All, Better way to handle popups instead of using Autoit. Use Win32API.new("user32", "GetWindow", 'Li', 'L').Call(@ie.hwnd.to_i, 6). This returns 0 if there was no popup and returns a handle to the popup if present. Have also done the popup handling method, will add that in too. The below changes handle 2 popups that occur in ie6. SECURITY INFORMATION and Security Alert - Just presses Yes to continue. Any other popup that occurs, this will return immediately, instead of getting stuck. In IE7 and IE8 no popup is displayed but a new webpage is displayed. Hence modified the got method to click on the continue when there is a security error. This works fine on IE 7 and IE 8. Not sure on how to create a test page for this, you would have to remove the certs from your browser to see the security error. Not sure on the git hub thingy ... but followed zeljkofilipin blog ( thanks... made life a lot easier :) and updated the code. Still have more doubts though .... Public Clone URL: git://github.com/ynot408/watir.git Have updated the code and pushed it. Changes made to ie-class.rb, goto method and wait method- # Navigate to the specified URL. # * url - string - the URL to navigate to def goto(url) @ie.navigate(url) wait if self.title == "Certificate Error: Navigation Blocked" #handle security error in IE 7, IE 8 shows up as a webpage and not dialog self.link(:id, "overridelink").click end return @down_load_time end def wait(no_sleep=false) @xml_parser_doc = nil @down_load_time = 0.0 a_moment = 0.2 # seconds start_load_time = Time.now outval = ' ' * 30 popwndtitle = '' begin while @ie.busy # XXX need to add time out sleep a_moment # 1-SECURITY INFORMATION - PAGE CONTAINS BOTH SECURE AND INSECURE ITEMS YES-6 # 2-Security Alert - Certificate error YES-1 pophwnd = Win32API.new("user32", "GetWindow", 'Li', 'L').Call(@ie.hwnd.to_i, 6) # only handle if there is a popup and handle only 2 popups, if any other popups occur return. if pophwnd !=0 Win32API.new("user32", "GetWindowText", 'Lpi', 'L').Call(pophwnd,outval,30) popwndtitle = outval.rstrip.chomp("\000") return 0 if !(popwndtitle.include?("Security Alert") || popwndtitle.include?("Security Information")) cntrlhwndYES = Win32API.new("user32", "GetDlgItem", 'Li', 'L').Call(pophwnd, 1) Win32API.new("user32", "SendMessage",'LLLL','L').Call(cntrlhwndYES, 0x0006, 1,0) Win32API.new("user32", "SendMessage",'LLLL','L').Call(cntrlhwndYES, 0x00F5, 0,0) cntrlhwndYES = Win32API.new("user32", "GetDlgItem", 'Li', 'L').Call(pophwnd, 6) Win32API.new("user32", "SendMessage",'LLLL','L').Call(cntrlhwndYES, 0x0006, 1,0) Win32API.new("user32", "SendMessage",'LLLL','L').Call(cntrlhwndYES, 0x00F5, 0,0) end end until @ie.readyState == READYSTATE_COMPLETE do sleep a_moment end ...... everything else remains the same Thanks, Tony From anukul.singhal at gmail.com Mon Jul 13 05:23:54 2009 From: anukul.singhal at gmail.com (anukul.singhal at gmail.com) Date: Mon, 13 Jul 2009 09:23:54 +0000 Subject: [Wtr-development] Added support for handling security popups whenloading a page In-Reply-To: <8ac3ceb30907130220v2d27513dp13d6a99c6d21c9b2@mail.gmail.com> References: <8ac3ceb30907130220v2d27513dp13d6a99c6d21c9b2@mail.gmail.com> Message-ID: <851808190-1247477040-cardhu_decombobulator_blackberry.rim.net-1846619210-@bxe1071.bisx.produk.on.blackberry> Tony, Could we do a similar check to handle popups in firefox as well? Sent on my BlackBerry? from Vodafone Essar -----Original Message----- From: "! Tony !" Date: Mon, 13 Jul 2009 14:50:00 To: Subject: [Wtr-development] Added support for handling security popups when loading a page Hi All, Better way to handle popups instead of using Autoit. Use Win32API.new("user32", "GetWindow", 'Li', 'L').Call(@ie.hwnd.to_i, 6). This returns 0 if there was no popup and returns a handle to the popup if present. Have also done the popup handling method, will add that in too. The below changes handle 2 popups that occur in ie6. SECURITY INFORMATION and Security Alert - Just presses Yes to continue. Any other popup that occurs, this will return immediately, instead of getting stuck. In IE7 and IE8 no popup is displayed but a new webpage is displayed. Hence modified the got method to click on the continue when there is a security error. This works fine on IE 7 and IE 8. Not sure on how to create a test page for this, you would have to remove the certs from your browser to see the security error. Not sure on the git hub thingy ... but followed zeljkofilipin blog ( thanks... made life a lot easier :) and updated the code. Still have more doubts though .... Public Clone URL: git://github.com/ynot408/watir.git Have updated the code and pushed it. Changes made to ie-class.rb, goto method and wait method- # Navigate to the specified URL. # * url - string - the URL to navigate to def goto(url) @ie.navigate(url) wait if self.title == "Certificate Error: Navigation Blocked" #handle security error in IE 7, IE 8 shows up as a webpage and not dialog self.link(:id, "overridelink").click end return @down_load_time end def wait(no_sleep=false) @xml_parser_doc = nil @down_load_time = 0.0 a_moment = 0.2 # seconds start_load_time = Time.now outval = ' ' * 30 popwndtitle = '' begin while @ie.busy # XXX need to add time out sleep a_moment # 1-SECURITY INFORMATION - PAGE CONTAINS BOTH SECURE AND INSECURE ITEMS YES-6 # 2-Security Alert - Certificate error YES-1 pophwnd = Win32API.new("user32", "GetWindow", 'Li', 'L').Call(@ie.hwnd.to_i, 6) # only handle if there is a popup and handle only 2 popups, if any other popups occur return. if pophwnd !=0 Win32API.new("user32", "GetWindowText", 'Lpi', 'L').Call(pophwnd,outval,30) popwndtitle = outval.rstrip.chomp("\000") return 0 if !(popwndtitle.include?("Security Alert") || popwndtitle.include?("Security Information")) cntrlhwndYES = Win32API.new("user32", "GetDlgItem", 'Li', 'L').Call(pophwnd, 1) Win32API.new("user32", "SendMessage",'LLLL','L').Call(cntrlhwndYES, 0x0006, 1,0) Win32API.new("user32", "SendMessage",'LLLL','L').Call(cntrlhwndYES, 0x00F5, 0,0) cntrlhwndYES = Win32API.new("user32", "GetDlgItem", 'Li', 'L').Call(pophwnd, 6) Win32API.new("user32", "SendMessage",'LLLL','L').Call(cntrlhwndYES, 0x0006, 1,0) Win32API.new("user32", "SendMessage",'LLLL','L').Call(cntrlhwndYES, 0x00F5, 0,0) end end until @ie.readyState == READYSTATE_COMPLETE do sleep a_moment end ...... everything else remains the same Thanks, Tony _______________________________________________ Wtr-development mailing list Wtr-development at rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-development From zeljko.filipin at wa-research.ch Mon Jul 13 05:36:40 2009 From: zeljko.filipin at wa-research.ch (=?UTF-8?Q?=C5=BDeljko_Filipin?=) Date: Mon, 13 Jul 2009 11:36:40 +0200 Subject: [Wtr-development] Added support for handling security popups when loading a page In-Reply-To: <8ac3ceb30907130220v2d27513dp13d6a99c6d21c9b2@mail.gmail.com> References: <8ac3ceb30907130220v2d27513dp13d6a99c6d21c9b2@mail.gmail.com> Message-ID: On Mon, Jul 13, 2009 at 11:20 AM, ! Tony ! wrote: > Not sure on the git hub thingy ... but followed zeljkofilipin blog ( > thanks... made life a lot easier :) Tony, I am glad you found it useful. :) I got Git working both on Mac and Windows. I will probably post how to set up Windows today or tomorrow. ?eljko -------------- next part -------------- An HTML attachment was scrubbed... URL: From jared at kilmore.info Thu Jul 2 09:39:46 2009 From: jared at kilmore.info (Jared Quinert) Date: Thu, 02 Jul 2009 23:39:46 +1000 Subject: [Wtr-development] Running scripts against Watir and Celerity Message-ID: <4A4CB8A2.7070204@kilmore.info> I posted questions a while back about having a Celerity-style driver for Watir. I've got an interim solution, which also helps me solve/work around issues in differences in behaviour between different Watir drivers. It doesn't give me a native 'browserless' solution running on Windows, but it does at least let me run the same scripts using Watir/Ruby-Win32 and Celerity/JRuby. Anyway, I've documented my first-cut, rough solution on my blog at http://www.software-testing.com.au/blog/index.php?itemid=88. I'd be happy to have feedback, and hopefully it helps someone. Jared http://www.software-testing.com.au/blog/ From ynot408 at gmail.com Mon Jul 13 05:20:00 2009 From: ynot408 at gmail.com (! Tony !) Date: Mon, 13 Jul 2009 14:50:00 +0530 Subject: [Wtr-development] Added support for handling security popups when loading a page Message-ID: <8ac3ceb30907130220v2d27513dp13d6a99c6d21c9b2@mail.gmail.com> Hi All, Better way to handle popups instead of using Autoit. Use Win32API.new("user32", "GetWindow", 'Li', 'L').Call(@ie.hwnd.to_i, 6). This returns 0 if there was no popup and returns a handle to the popup if present. Have also done the popup handling method, will add that in too. The below changes handle 2 popups that occur in ie6. SECURITY INFORMATION and Security Alert - Just presses Yes to continue. Any other popup that occurs, this will return immediately, instead of getting stuck. In IE7 and IE8 no popup is displayed but a new webpage is displayed. Hence modified the got method to click on the continue when there is a security error. This works fine on IE 7 and IE 8. Not sure on how to create a test page for this, you would have to remove the certs from your browser to see the security error. Not sure on the git hub thingy ... but followed zeljkofilipin blog ( thanks... made life a lot easier :) and updated the code. Still have more doubts though .... Public Clone URL: git://github.com/ynot408/watir.git Have updated the code and pushed it. Changes made to ie-class.rb, goto method and wait method- # Navigate to the specified URL. # * url - string - the URL to navigate to def goto(url) @ie.navigate(url) wait if self.title == "Certificate Error: Navigation Blocked" #handle security error in IE 7, IE 8 shows up as a webpage and not dialog self.link(:id, "overridelink").click end return @down_load_time end def wait(no_sleep=false) @xml_parser_doc = nil @down_load_time = 0.0 a_moment = 0.2 # seconds start_load_time = Time.now outval = ' ' * 30 popwndtitle = '' begin while @ie.busy # XXX need to add time out sleep a_moment # 1-SECURITY INFORMATION - PAGE CONTAINS BOTH SECURE AND INSECURE ITEMS YES-6 # 2-Security Alert - Certificate error YES-1 pophwnd = Win32API.new("user32", "GetWindow", 'Li', 'L').Call(@ie.hwnd.to_i, 6) # only handle if there is a popup and handle only 2 popups, if any other popups occur return. if pophwnd !=0 Win32API.new("user32", "GetWindowText", 'Lpi', 'L').Call(pophwnd,outval,30) popwndtitle = outval.rstrip.chomp("\000") return 0 if !(popwndtitle.include?("Security Alert") || popwndtitle.include?("Security Information")) cntrlhwndYES = Win32API.new("user32", "GetDlgItem", 'Li', 'L').Call(pophwnd, 1) Win32API.new("user32", "SendMessage",'LLLL','L').Call(cntrlhwndYES, 0x0006, 1,0) Win32API.new("user32", "SendMessage",'LLLL','L').Call(cntrlhwndYES, 0x00F5, 0,0) cntrlhwndYES = Win32API.new("user32", "GetDlgItem", 'Li', 'L').Call(pophwnd, 6) Win32API.new("user32", "SendMessage",'LLLL','L').Call(cntrlhwndYES, 0x0006, 1,0) Win32API.new("user32", "SendMessage",'LLLL','L').Call(cntrlhwndYES, 0x00F5, 0,0) end end until @ie.readyState == READYSTATE_COMPLETE do sleep a_moment end ...... everything else remains the same Thanks, Tony From anukul.singhal at gmail.com Mon Jul 13 05:23:54 2009 From: anukul.singhal at gmail.com (anukul.singhal at gmail.com) Date: Mon, 13 Jul 2009 09:23:54 +0000 Subject: [Wtr-development] Added support for handling security popups whenloading a page In-Reply-To: <8ac3ceb30907130220v2d27513dp13d6a99c6d21c9b2@mail.gmail.com> References: <8ac3ceb30907130220v2d27513dp13d6a99c6d21c9b2@mail.gmail.com> Message-ID: <851808190-1247477040-cardhu_decombobulator_blackberry.rim.net-1846619210-@bxe1071.bisx.produk.on.blackberry> Tony, Could we do a similar check to handle popups in firefox as well? Sent on my BlackBerry? from Vodafone Essar -----Original Message----- From: "! Tony !" Date: Mon, 13 Jul 2009 14:50:00 To: Subject: [Wtr-development] Added support for handling security popups when loading a page Hi All, Better way to handle popups instead of using Autoit. Use Win32API.new("user32", "GetWindow", 'Li', 'L').Call(@ie.hwnd.to_i, 6). This returns 0 if there was no popup and returns a handle to the popup if present. Have also done the popup handling method, will add that in too. The below changes handle 2 popups that occur in ie6. SECURITY INFORMATION and Security Alert - Just presses Yes to continue. Any other popup that occurs, this will return immediately, instead of getting stuck. In IE7 and IE8 no popup is displayed but a new webpage is displayed. Hence modified the got method to click on the continue when there is a security error. This works fine on IE 7 and IE 8. Not sure on how to create a test page for this, you would have to remove the certs from your browser to see the security error. Not sure on the git hub thingy ... but followed zeljkofilipin blog ( thanks... made life a lot easier :) and updated the code. Still have more doubts though .... Public Clone URL: git://github.com/ynot408/watir.git Have updated the code and pushed it. Changes made to ie-class.rb, goto method and wait method- # Navigate to the specified URL. # * url - string - the URL to navigate to def goto(url) @ie.navigate(url) wait if self.title == "Certificate Error: Navigation Blocked" #handle security error in IE 7, IE 8 shows up as a webpage and not dialog self.link(:id, "overridelink").click end return @down_load_time end def wait(no_sleep=false) @xml_parser_doc = nil @down_load_time = 0.0 a_moment = 0.2 # seconds start_load_time = Time.now outval = ' ' * 30 popwndtitle = '' begin while @ie.busy # XXX need to add time out sleep a_moment # 1-SECURITY INFORMATION - PAGE CONTAINS BOTH SECURE AND INSECURE ITEMS YES-6 # 2-Security Alert - Certificate error YES-1 pophwnd = Win32API.new("user32", "GetWindow", 'Li', 'L').Call(@ie.hwnd.to_i, 6) # only handle if there is a popup and handle only 2 popups, if any other popups occur return. if pophwnd !=0 Win32API.new("user32", "GetWindowText", 'Lpi', 'L').Call(pophwnd,outval,30) popwndtitle = outval.rstrip.chomp("\000") return 0 if !(popwndtitle.include?("Security Alert") || popwndtitle.include?("Security Information")) cntrlhwndYES = Win32API.new("user32", "GetDlgItem", 'Li', 'L').Call(pophwnd, 1) Win32API.new("user32", "SendMessage",'LLLL','L').Call(cntrlhwndYES, 0x0006, 1,0) Win32API.new("user32", "SendMessage",'LLLL','L').Call(cntrlhwndYES, 0x00F5, 0,0) cntrlhwndYES = Win32API.new("user32", "GetDlgItem", 'Li', 'L').Call(pophwnd, 6) Win32API.new("user32", "SendMessage",'LLLL','L').Call(cntrlhwndYES, 0x0006, 1,0) Win32API.new("user32", "SendMessage",'LLLL','L').Call(cntrlhwndYES, 0x00F5, 0,0) end end until @ie.readyState == READYSTATE_COMPLETE do sleep a_moment end ...... everything else remains the same Thanks, Tony _______________________________________________ Wtr-development mailing list Wtr-development at rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-development From zeljko.filipin at wa-research.ch Mon Jul 13 05:36:40 2009 From: zeljko.filipin at wa-research.ch (=?UTF-8?Q?=C5=BDeljko_Filipin?=) Date: Mon, 13 Jul 2009 11:36:40 +0200 Subject: [Wtr-development] Added support for handling security popups when loading a page In-Reply-To: <8ac3ceb30907130220v2d27513dp13d6a99c6d21c9b2@mail.gmail.com> References: <8ac3ceb30907130220v2d27513dp13d6a99c6d21c9b2@mail.gmail.com> Message-ID: On Mon, Jul 13, 2009 at 11:20 AM, ! Tony ! wrote: > Not sure on the git hub thingy ... but followed zeljkofilipin blog ( > thanks... made life a lot easier :) Tony, I am glad you found it useful. :) I got Git working both on Mac and Windows. I will probably post how to set up Windows today or tomorrow. ?eljko -------------- next part -------------- An HTML attachment was scrubbed... URL: