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:
- Add headers to an HTTP request passed by the driver.
- Add parameters to such a request, as if the driver got his target URL after submitting a form.
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.)
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.