I've recently been playing around with AJAX (hasn't everyone?) and something annoying that I have noticed is the following:

If you load an HTML page into IE that contains a div tag, like this:

<div id="ajaxstuff" >Hello World!</div>

and a javascript function that somehow changes this div's content, like this:

document.getElementById("ajaxstuff").innerHTML = 'Howdy!';

maybe this javascript is inside a function that gets run when the page loads:

<body onLoad="init();">

or maybe it gets run as the result of an event, like clicking a button somewhere on the page - it doesn't seem to make a difference...

If you select 'view->source' from the IE browser menu anytime after this function has been run, you will see the original "Hello World!" message, not the updated "Howdy!" message - even though "Howdy!" is being displayed in the current browser window!

This doesn't really answer your question (sorry!) - but I think it's an important clue to what you're seeing: if a page is somehow modified by javascript after the initial page load, then view->source will not reflect the update, but will instead show the original HTML. So any script attempting to mechanize this will be hitting the proverbial moving target.

You might be able to 'reverse engineer' the real (updated) HTML by looking for div tags, javascript functions, and possibly URLS invoked behind the scenes (if you point your browser to these, you'll get back the raw response data used to update the page).

Of course, it may be encrypted or obfuscated, etc., but it's worth a try.

BTW - firefox seems to do the same thing. :-(

Good luck!


In reply to Re: Win32::IE::Mechanize not getting correct content by scorpio17
in thread Win32::IE::Mechanize not getting correct content by cormanaz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.