- Install Watir + ruby (http://watir.com/installation/#mac)
- The plugin provided on the site didn't work for me, had to install the plugin on (http://wiki.openqa.org/display/WTR/FireWatir+Installation#FireWatirInstallation-InstalltheJSSHFirefoxExtension)
- After installing the plugin successfully I was getting "RuntimeError: Firefox is running without -jssh" when running a script
- As a work around, start firefox from the terminal giving the -jssh option
/Applications/Firefox.app/Contents/MacOS/firefox-bin -P testyard -jssh
require "watir"
$b = Watir::Browser.new
$b.goto "http://www.example.com"
$b.text_field(:id, 'user').set('test@test.com')
$b.text_field(:id, 'password').set('psw')
$b.button(:value, 'Login').click
begin
file=File.open("test.txt")
while(f=file.gets)
sleep 10
$b.goto "#{f}"
$contents = $b.div(:id,'test').text
puts $contents.split('delimitter')[1].split(' ')[0]
end
file.close
end