title: How to impersonate JS enabled browser?
body: <p>I need to download a webpage using script (PHP, Python, Bash) and not using GUI browser. The problem is the web page checks up front is it deals with JS enabled browser. So all I got using naive downloading from given URL is initial page (in this case I think about Coursera courses page: <a href="http://pastebin.com/4tJJRMTu" rel="nofollow">http://pastebin.com/4tJJRMTu</a>).</p>
  
  <p>How can I download the "real" content using script? So far I can think about such solutions (some crazy ones):</p>
  
  <ul>
  <li>figuring out what JS on startup pages does, and mimic this in my script, probably loading another page</li>
  <li>scan network traffic using Wireshark and find a pattern that request for page <code>ABC1.html</code> ends up with fetching page <code>ABC1body.html</code></li>
  <li>instead of native (for given language) download feature launch external browser to just download the page (<code>exec Firefox --dump http://foo.bar/x.html</code> -- I am making this up, I even don't know if there is a browser with scripting capability).</li>
  </ul>
  
  <p>And other ideas? I would be grateful for tested ones.</p>
  
  <p><em>Dropping script and instead writing a browser plugin is also one of the options, but since I already put some time to write the scripts for now it seems quicker to fix them, instead writing them from scratch.</em></p>