Created
January 9, 2013 23:41
-
-
Save umaar/4498067 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'sim_launcher' | |
| require 'selenium-webdriver' | |
| simulator = SimLauncher::DirectClient.for_iphone_app( "iWebDriver.app", '6.0' ) | |
| simulator.relaunch() | |
| # see if iWebDriver is loaded(contact the host) | |
| # retry a few times just incase | |
| connected = false | |
| (0..2).each do | |
| begin | |
| Net::HTTP.new("localhost", 3005).start | |
| connected = true | |
| break | |
| rescue | |
| sleep(2) | |
| end | |
| end | |
| unless connected | |
| raise 'Could not launch iPhone webdriver' | |
| end | |
| @driver = Selenium::WebDriver.for :remote, :url => "http://localhost:3005/hub", :desired_capabilities => :iphone | |
| @driver.navigate.to "http://google.com" | |
| puts @driver.title | |
| `/usr/bin/osascript -e 'application "iPhone Simulator" quit'` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment