Adds HTTP status code and response headers emulation to Selenium drivers.

Latest release tested on OS X 10.12.3 with:

Browser Driver
Chrome 60.0.3112.40 ChromeDriver 2.30.477690
Safari 10.0.3 built-in safaridriver
Firefox 54.0 --
PhantomJS 2.2.1 --

Note: Ensure Develop > Allow Remote Automation is enabled in Safari!


Install with Bundler by adding the following line to your Gemfile:

gem "selenium-emulated_features", "~> 3.0"

Or install via RubyGems:

% gem install selenium-emulated_features


require "selenium-webdriver"
require "selenium/emulated_features"

driver = Selenium::WebDriver.for(:firefox)"")

driver.response_code    # => 404
driver.response_headers # => {...}

nil is returned if the URI is not reachable or an error occurs.