Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Headers and Selenium Webdriver 2

Is there any way to add a header in Selenium WebDriver test? (Like with Firefox Modify Headers plugin) I cannot use HtmlUnitDriver, because the browser has to be visible.

like image 463
mjgirl Avatar asked Nov 02 '25 08:11

mjgirl


1 Answers

WebDriver does not allow you to change or set the headers using any of the browser based drivers. You can find a lot of information about their decision about the headers and the response codes at the following URL. http://code.google.com/p/selenium/issues/detail?id=141

We use Apache HTTP Client for this type of testing where we do not want to check the rendered page elements, but just the responses and header information.

You can also give browser mob proxy with your selenium tests as well as mentioned in the url above. I have used this for other purposes and it is awesome.

like image 170
haroonzone Avatar answered Nov 04 '25 17:11

haroonzone