How to get HTTP Response Code using Selenium WebDriver

Ralph picture Ralph · Jun 28, 2011 · Viewed 171.5k times · Source

I have written tests with Selenium2/WebDriver and want to test if HTTP Request returns an HTTP 403 Forbidden.

Is it possible to get the HTTP response status code with Selenium WebDriver?

Answer

JimEvans picture JimEvans · Jun 28, 2011

In a word, no. It's not possible using the Selenium WebDriver API. This has been discussed ad nauseam in the issue tracker for the project, and the feature will not be added to the API.