title: How to add headers or parameters to an HTTP request handled with Selenium Webdriver?
body: <p>I'm using Selenium Webdriver for unit testing of a web application. It's used in JUnit tests Despite reading the available documentation extensively and searching around, I could not find a way to:</p>
  
  <ul>
  <li>Add headers to an HTTP request passed by the driver.</li>
  <li>Add parameters to such a request, as if the driver got his target URL after submitting a form.</li>
  </ul>
  
  <p>It would be possible to create a test web page with an appropriate form and have Webdriver bounce off it to get those parameters automatically, but this is quite an ugly hack. I would like to avoid it, especially for the sake of test atomicity. (This is unit testing.)</p>
  
  <p>Before Wendriver, I was using Spring's MockHttpServletRequest and MockHttpServletResponse to do this, which worked like a charm, but I would like to use the power of Webdriver to assert the target page's contents.</p>