title: Emulating a web browser to wrap the functionality of several similar web sites
body: <p>I'm interested in emulating the functionality of a web browser in C++ so that I can create a wrapper for several web sites. Right now, the biggest issues with these sites are that they make heavy use of JavaScript that interacts with the HTML DOM. Thus, the simple solution of using curl to download the page, and something like <a href="http://rapidxml.sourceforge.net" rel="nofollow">RapidXML</a> to parse its contents is out.</p>
  
  <p>Next, I considered using something like <a href="http://code.google.com/p/v8/" rel="nofollow">v8</a> with curl, and that solves the issue of interpreting the JavaScript on the page nicely. However, it doesn't solve the issue of connecting the HTML DOM methods with the JavaScript; in other words, <code>document.getElementById()</code> would fail in v8.</p>
  
  <p>Next, I considered <a href="http://www.webkit.org/" rel="nofollow">WebKit</a>, which seems like it's perfectly suited to emulate a web browser--after all, Chromium and Safari both utilize it in their web browsers. However, it's a little too complete. I don't need all of the rendering aspects it includes.</p>
  
  <p>So, I'd be looking for some way to:</p>
  
  <ol>
  <li>Make an SSL connection to a web site</li>
  <li>Interpret the JavaScript on that web site in connection with the HTML DOM</li>
  <li>Set the value of the username/passwords <code>&lt;input&gt;</code> fields with my username and password</li>
  <li>Simulate clicking the "Submit" button by calling the <code>formSubmit()</code> function, from <code>&lt;input type="button" onClick="formSubmit()"&gt;</code></li>
  <li>Handle the HTTP POST form action and the subsequent HTTP 301 and JavaScript redirects (accomplished using <code>window.location</code>)</li>
  <li>Repeat 2-5 as needed</li>
  </ol>
  
  <p>Besides what I've already considered, what other options do I have? Ideally, I'd want this to be extremely lightweight, without requiring linking to many libraries.</p>
  
  <p>I'm primarily concerned with developing for Windows 7 64-bit.</p>