Skip to content

Fetching rendered JavaScript from a page (Omniture pixel)?

I have some code (incidentally, it is for Omniture SiteCatalyst) that renders a 1×1 pixel based on some JavaScript object variables I set in the page’s source code. The JavaScript eventually creates an img based on the scripting code, but the img src isn’t hard-coded into the HTML. How can I figure out what the img src is, given the URL of a page? If I just grab the page, I’ll get the pre-rendered JavaScript.


For example, let’s say I have this code for StackOverflow.html:

<script type="text/javascript">
a = 2

How can I fetch StackOverflow.html and somehow get the value “2” instead of all of my scripting code?




I think the best way to do this is with Selenium, and then inject some javascript in the page to either mine the DOM, or retrieve the value from the window global if appropriate.