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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.