in reply to Re: Error trying to get the document object from a frame
in thread Error trying to get the document object from a frame

Hi, thanks for the reply! Your guess is pretty much spot on.
This is not an exact code snippet, since this is spread out through other modules, but it is exactly what's happening, and this time, is fully working code:
#!/usr/bin/perl -w use strict; use warnings; use diagnostics; use Win32::OLE qw(in with EVENTS); my $URL = 'http://www.pageresource.com/html/frameex5.htm'; my $IEWin = ''; my $IEObject = undef; my $Class = 'InternetExplorer.Application'; $IEWin = Win32::OLE->new +( $Class ) || die "Can not obtain a $Class object\n"; $IEWin->{visible} = 1; $IEWin->Navigate($URL); my $wait = 300; until ( $IEWin->{Busy} != 1 || $wait <= 0 ) { $wait--; sleep 1; } my $IEDoc = $IEWin->{Document}; my $frames = $IEDoc->{frames}; my %frameshash; for (my $i = 0; $i < $frames->{length}; $i++) { $frameshash{$frames->{$i}->{name}} = $frames->{$i}; } foreach my $key ( keys( %frameshash ) ) { print "\n".$key."\n"; print $frameshash{$key}->{document}->{body}->{innerHTML}."\n"; }

And yes, it IS weird. With good consistancy, once in a frame we can access everything but 'document' and 'frames'. The frames element I don't care about (since I'm already in the lower most frame) but document is fairly important :)
Why do this? For automation consistancy. We (note I've changed from "I" to "we" :p ) have a number of perl scripts and modules for automation. Not everything is necessarily for web pages. The method we're using isn't important, but the end result is. We need the document object so we can go automation crazy on it.
Like I said earlier, the really strange part is this works perfectly fine on 4 computers, but not at all on 3 computers. This is a mix of (Windows) OSs and IE versions, and we just can't nail down any consistancy.