Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Capybara use Internet Explorer as browser rather than Firefox

Hi is it possible to tell Capybara to use IE instead of always defaulting to Firefox?

I have to write some automated tests but the business only supports Internet Explorer so I need the tests to be run on this browser.

Thanks.

like image 832
logi Avatar asked Jul 16 '11 07:07

logi


1 Answers

As marc_s suggested in the comments, you could try making IE the default browser on your test machine.

I also see some google hits about using Capybara with Selenium (remote control).

If you're interested, check the Selenium docs for how to specify the browser.

Edit It seems the tutorial I posted before was Rack-only. Not sure, but maybe this will work instead:

http://www.johng.co.uk/2010/10/13/run_capybara_and_cucumber_features_in_internet_explorer_on_remote_windows/

Capybara.app_host = "http://192.168.1.37:3000"
Capybara.default_driver = :selenium
Capybara.register_driver :selenium do |app|
  Capybara::Driver::Selenium.new(app,
    :browser => :remote,
    :url => "http://192.168.1.127:4444/wd/hub",
    :desired_capabilities => :internet_explorer)
end

It still requires Selenium.

Edit 2:

If you get this error:

Capybara::TimeoutError: failed to resynchronize, ajax request timed out

Then try adding this code to features/step_definitions/mydefiniation.rb:

Before do
  page.driver.options[:resynchronize] = false
end

See this question about that specific problem: Using Capybara for AJAX integration tests

like image 63
Merlyn Morgan-Graham Avatar answered Oct 15 '22 03:10

Merlyn Morgan-Graham