+1 -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bret Pettichord Sent: Friday, September 30, 2005 2:10 PM To: [email protected] Subject: Re: [Wtr-general] How do I save a web page from a test run (attempt using Win32API)?
Try this instead: ie.ie.document.body.parentelement.outerhtml By rights, ie.html should give you what you want, but it actually only includes the body of the document. I think this is a bug and am inclined to replace it with the former. Comments? Bret At 03:53 PM 9/30/2005, Joe Yakich wrote: >Everyone, > >Canoo WebTest has a nice feature whereby the HTML pages of the application >under test are saved for viewing later, which is very handy when a test case >fails. > >So, I went looking for something similar in Rubyland, and ran across this >posting. > >http://rubyforge.org/pipermail/win32utils-devel/2005-April/000358.html > >With some modification (since I want to save the HTML, not get a screen >print), I came up with the following code that doesn't quite work. As a >bonus, it somehow hoses Windows (DOS command windows become gigantic and >non-functional, keyboard input no longer functions, etc.) > >Any Win32 experts see what I've left out? > >Thanks in advance! > >Joe > > > >class SaveWebPage > require 'Win32API' > > def initialize > @KEYEVENTF_KEYUP = 0x2 > @SW_HIDE = 0 > @SW_SHOW = 5 > @SW_SHOWNORMAL = 1 > @VK_CONTROL = 0x11 > @VK_F4 = 0x73 > @VK_MENU = 0x12 > @VK_RETURN = 0x0D > @VK_SHIFT = 0x10 > @VK_SNAPSHOT = 0x2C > @VK_TAB = 0x09 > end > > # Use IE's "save page as" menu selection (Alt, F, A, S) > def save_page > keybd_event = Win32API.new("user32", "keybd_event", ['I','I','L','L'], >'V') > vkKeyScan = Win32API.new("user32", "VkKeyScan", ['I'], 'I') > > keybd_event.Call(@VK_MENU, 1, 0, 0) > keybd_event.Call(vkKeyScan.Call(?F), 1, 0, 0) > keybd_event.Call(vkKeyScan.Call(?A), 1, 0, 0) > keybd_event.Call(vkKeyScan.Call(?S), 1, 0, 0) > end >end > > > > >_______________________________________________ >Wtr-general mailing list >[email protected] >http://rubyforge.org/mailman/listinfo/wtr-general _____________________ Bret Pettichord www.pettichord.com _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
