yes we have seen some of the same reports from people using vista. i was using vista a lot a long time ago, but i deactivated lots of the stuff that made vista really annoying, and did not see the problem behaviors.
if you want to know more about what people are doing on vista, you should post a note to watir-general. bret On Sat, Oct 17, 2009 at 4:29 PM, Ethan <notet...@gmail.com> wrote: > On Fri, Oct 16, 2009 at 20:16, Ethan <notet...@gmail.com> wrote: > > There seems to be some issue with WIN32OLE on windows 7 (I am using the >> last release candidate). This of course causes problems with Watir. This >> comes up with navigating to local URLs. It seems to be fine doing remote >> stuff: >> >> >> ie=WIN32OLE.new 'InternetExplorer.Application' >> => #<WIN32OLE:0x4645718> >> >> ie.visible=true >> => true >> >> ie.navigate 'google.com' >> => nil >> >> ie.document >> => #<WIN32OLE:0x46377a8> >> >> ie.document.title >> => "Google" >> >> ie.navigate 'C:/watir/watir/unittests/html/textfields1.html' >> => nil >> >> ie.document >> WIN32OLERuntimeError: unknown property or method `document' >> HRESULT error code:0x800706b5 >> The interface is unknown. >> from (irb):34:in `method_missing' >> from (irb):34 >> >> The error message seems to vary from time to time. I have also gotten >> (also immediately after navigating to a local file): >> >> >> ie.document >> WIN32OLERuntimeError: unknown property or method `document' >> HRESULT error code:0x80010108 >> The object invoked has disconnected from its clients. >> from (irb):26:in `method_missing' >> from (irb):26 >> >> and >> >> >> ie.document >> WIN32OLERuntimeError: unknown property or method `document' >> HRESULT error code:0x800706ba >> The RPC server is unavailable. >> from (irb):8:in `method_missing' >> from (irb):8 >> >> >> -Ethan >> > > Continuing, after more playing around: > > Reattaching works fine - iterating over > WIN32OLE.new('Shell.Application').Windows yields the IE window, and likewise > IE.attach works. > illustrated in code, picking up where the previous code snippet left off, > with a window open at textfields1.html, but its WIN32OLE object > disconnected: > > >> > ie_sa=WIN32OLE.new('Shell.Application').Windows.extend(Enumerable).detect{|win| > win.path=~/Internet Explorer/ && win.locationURL=~/textfields1\.html/ } > => #<WIN32OLE:0x4be32ec> > > >> ie_sa.navigate 'google.com' > => nil > > Interestingly, navigating outside of the local drive launches a completely > separate window - after the call to ie_sa.navigate 'google.com', there is > now one IE window at textfields1.html, and another at google.com. the > ie_sa WIN32OLE still points at the one at textfields1.html. > > >> ie_sa.locationURL > => "file:///C:/watir/watir/unittests/html/textfields1.html" > > The same thing happens if I actually go into the browser, type 'google.com' > in the url bar and hit enter - it opens a new browser window and leaves the > existing browser window at textfields1.html. > > Navigating to other places on the local drive works fine. > > >> ie_sa.navigate 'C:\watir\watir\unittests\html\div.html' > => nil > >> ie_sa.locationURL > => "file:///C:/watir/watir/unittests/html/div.html" > > I have talked about this a bit with a friend who is more knowledgeable, > which conversation I will paste here: > <him> starting with vista, processes have integrity levels > <him> this is for security > <him> basically some processes are less trusted than others > <him> IE runs as a low integrity process > <him> this is more or less its 'protected mode' > <him> where it can only write to constrained low-integrity portions of the > hard drive and read cookies/cache and not much else > <him> so now there's IE8 > <him> IE8 has a whole bunch of different processes > <him> per-tab processes which are all low integrity > <him> and the high level frame process which is medium integrity > <him> when you navigate from a non-local (i.e. "intranet zone") site to a > local one, protected mode goes off and the process integrity very likely > gets elevated to medium > <Ethan> in options, turning off "Enable Protected Mode" seems to disable > all this, yeah? > <him> turning off protected mode will force all tabs to run at medium > integrity and avoid the transition > > This is what I seem to observe in process explorer: > Opening a WIN32OLE.new 'InternetExplorer.Application' causes a window to > launch, which consists of two processes: a medium-integrity one that is the > main window, and a low-integrity one, child of the main window process, that > is the window in the tab, that interacts with the web pages it goes to. > When navigating to a local file, a third process launches, also a child of > the main window, with medium integrity. after a bit, the low-integrity > process terminates. This is why the WIN32OLE disconnects. > Connecting WIN32OLE to the new medium-integrity process for the tab at the > local file works fine. But, the medium-integrity process refuses to go to > internet sites, so when you navigate to google.com, it launches another > low-integrity process, child of the main window process, and the > medium-integrity process at the local file stays where it is. > > A couple of not-very-good workarounds I've found: In IE's options, turning > off "Enable Protected Mode" makes everything run at medium integrity level, > so navigating to a local drive doesn't need a different process, and > WIN32OLE stays connected. But, of course, this is at the cost of having > protected mode on in IE, which is generally desirable. > > Another workaround is to run ruby.exe as administrator. This is even worse > than the previous; IE runs with the administrator integrity level which it > inherits from ruby - running at medium is better. > > A possibility that doesn't change integrity levels is to have the Watir::IE > instance store unique information unique to its OLE object (perhaps hwnd, > process id, url - none of those are in fact unique, but maybe in > combination, could be satisfactory), and reacquire an ole object from > Shell.Application if that disconnects. > > Apparently this is the case as of vista, though, not just 7. Are watir > users still generally on XP? I still am on XP at work, it's just fiddling > around at home that I am running into this. So it's not actually an issue > for me, but I expect it will be when we get on vista or 7 - don't know how > far off that is. > > Ethan > > > _______________________________________________ > Wtr-development mailing list > Wtr-development@rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-development > -- Bret Pettichord Lead Developer, Watir, www.watir.com Blog, www.io.com/~wazmo/blog Twitter, www.twitter.com/bpettichord
_______________________________________________ Wtr-development mailing list Wtr-development@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-development