Skip to content

Instantly share code, notes, and snippets.

@jmaicher
Created December 4, 2010 20:03
Show Gist options
  • Save jmaicher/728441 to your computer and use it in GitHub Desktop.
Save jmaicher/728441 to your computer and use it in GitHub Desktop.
Using Selenium with Cucumber and Fakeweb
# cucumber supports selenium by default, just mark features with @selenium tag
@selenium
Feature: This feature will be executed with selenium
...
# if you're using fakeweb, then you will get an error like the following
Real HTTP connections are disabled. Unregistered request: GET http://127.0.0.1:54602/__identify__ (FakeWeb::NetConnectNotAllowedError)
# this is because selenium runs the application on a different server. We need to tell fakeweb to allow those connections to localhost
# just put this to features/support/env.rb to enable connections to localhost
FakeWeb.allow_net_connect = %r[^https?://(localhost|127.0.0.1)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment