Skip to content

Instantly share code, notes, and snippets.

@refractalize
Created May 27, 2011 06:41
Show Gist options
  • Save refractalize/994760 to your computer and use it in GitHub Desktop.
Save refractalize/994760 to your computer and use it in GitHub Desktop.
env.rb for running Capybara for non-rails/rack apps.
require 'capybara'
require 'capybara/dsl'
Capybara.current_driver = :selenium
Capybara.app_host = 'localhost:3000'
Capybara.default_selector = :css
include Capybara::DSL
@LogaJ
Copy link

LogaJ commented Jul 15, 2011

Thanks for this. I want to use IE8 but the above will invoke Firefox. Hw can ypu specify which browser to use for the tests?

@kkganesan
Copy link

FYI for IE,
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(app, :browser => :ie)
end

@LogaJ
Copy link

LogaJ commented Dec 17, 2011

That works only for rack based apps. When I try to use the above I get errors as the application under test isn't ruby based.

@kkganesan
Copy link

I don't have any rack based specification in the configuration. The above was used to test java based web app. Indeed it can be used against any web app to launch IE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment