Skip to content

Instantly share code, notes, and snippets.

@pmeinhardt
Created October 18, 2012 10:04
Show Gist options
  • Save pmeinhardt/3910839 to your computer and use it in GitHub Desktop.
Save pmeinhardt/3910839 to your computer and use it in GitHub Desktop.
capybara iphone driver
# features/support/capybara.rb
# Configure Capybara for use with cucumber.
Capybara.configure do |config|
# Use iPhone as the default browser.
# config.default_driver = :iphone
end
# features/support/iphone.rb
require "selenium/webdriver"
Capybara.register_driver :iphone do |app|
# To use this driver, you need to run Selenium's iPhone driver app.
# This will allow you to test your applications in iOS Simulator or
# directly on a connected iOS device. Basic steps to get this running
# are:
#
# 1. Check out sources: http://code.google.com/p/selenium/source/checkout
# 2. Open the XCode project from selenium-read-only/selenium/iphone
# 3. Select the appropriate build config (e.g. "iPhone 6.0 Simulator")
# 4. Run the build, which will install and start the app
# 5. Run cucumber with the `default_driver` set to `:iphone`
#
# See http://code.google.com/p/selenium/wiki/IPhoneDriver for details.
Capybara::Selenium::Driver.new app, browser: :iphone
end
# features/support/tags.rb
Before('@iphone') do
Capybara.current_driver = :iphone
end
After('@iphone') do
Capybara.use_default_driver
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment