Monday, July 8, 2013

How to install watir on Windows XP / 7 (32 bit) for IE Webapp testing

(1) Goto http://rubyinstaller.org/downloads and download
Ruby 1.9.3-p429
DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe


(2) Download IEDriverServer_Win32_2.33.0.zip from
http://code.google.com/p/selenium/downloads/list
and extract to C:\Windows\


(3) install Ruby 1.9.3-p429 using Administrator
Choose Add Ruby executables to PATH and Associate .rb and .rbw
Install to say C:\Ruby193

(4) Double click and extract DevKit-tdm to say C:\Ruby193\DevKit


(5) Use Command Prompt (cmd.exe) and enter into DOS shell and run
cd C:\Ruby193\DevKit
ruby dk.rb init
ruby dk.rb install
gem install watir --no-ri --no-rdoc
# might have some errors after the last step
gem install nokogiri
gem install mini_magick -v 3.5
gem install watir --no-ri --no-rdoc
gem install watir-webdriver --no-ri --no-rdoc


(6) Use irb to test interative session on IE
require "watir"
browser = Watir::Browser.new
browser.goto("www.google.com")
browser.text_field(:name => 'q').set 'Watir Example'
browser.button(:name => 'btnK').click
browser.close

require "watir-webdriver"
browser = Watir::Browser.new :ie
browser.goto 'http://bit.ly/watir-example'
browser.text_field(:name => 'entry.0.single').set 'Watir'
browser.radio(:value => 'Watir').set




No comments: