| SafariWatir is not under active development. For more information download free version of Watir book and read About Watir chapter, or go directly to the About Watir page. |
SafariWatir
SafariWatir aims at adding Watir support for Safari on the Mac. SafariWatir is part of Watir project.
Dependencies
Mac OS X, Safari and rb-appscript. Some features require you to turn on "Enable access for assistive devices" in System Preferences > System > Universal Access.
Install
Install Xcode for Mac-only Development. It is 751.1 MB and you have to be registered as an Apple Developer, but the registration is free.
sudo gem update --system sudo gem install rb-appscript sudo gem install safariwatir
or
git clone git://github.com/redsquirrel/safariwatir.git
cd safariwatir
rake install
Code
require 'rubygems' require 'safariwatir' browser = Watir::Safari.new browser.goto("http://google.com") browser.text_field(:name, "q").set("obtiva") browser.button(:name, "btnI").click puts "FAILURE" unless browser.contains_text("software")
Running SafariWatir against Watir's core tests
# First, install the SafariWatir gem (see above)
git clone git://github.com/bret/watir.git
cd watir/watir #into your cloned directory
cp unittests/options.yml.example unittests/options.yml
# Edit unittests/options.yml and set browser: safari
ruby unittests/core_tests.rb
Contributors
Tom Copeland is lead developer of SafariWatir.
Previous contributors are:
- Dave Hoover, creator (dave.hoover@gmail.com)
- Caius Durling (dev@caius.name)
- Dane Jensen (careo@fastmail.fm)