Wednesday 2 July 2014

Watir installation with eclipse

For WatiR installation we required eclipse , ruby dltk plugin ,and obviously ruby.
1. Download Ruby from
http://rubyinstaller.org/downloads/

2.Eclipse Download from
www.eclipse.org/downloads/

3.For dltk download use the following link
Now add ruby dltk with your eclipse
Now open your eclipse and go to Help -> Install New Software

watir with eclipse
Click Add button and a small window will appear
Now click “Archive” button
And browse your dlt file and click Ok button now
Now check the check box and click next button
Click “Next” button
Now it install the software
Now after installing goto File -> New ->Other and select Ruby Project
Now we should see this window
Where we should provide project name and we need to configure the ruby interpreters click
“configure interpreters” link
And click Add button and browse the ruby executable
And click OK button in all window and finally we get this type of window
Click “Yes” button
Now add an empty ruby script file
Now set environmental variable gem with its path like – “E:\Ruby200\bin”
now open cmd and type – gem install watir
the out put should be –
C:\Users\tanmay>gem install watir
Fetching: commonwatir-4.0.0.gem (100%)
Successfully installed commonwatir-4.0.0
Fetching: multi_json-1.7.2.gem (100%)
Successfully installed multi_json-1.7.2
Fetching: rubyzip-0.9.9.gem (100%)
Successfully installed rubyzip-0.9.9
Fetching: ffi-1.7.0-x86-mingw32.gem (100%)
Successfully installed ffi-1.7.0-x86-mingw32
Fetching: childprocess-0.3.9.gem (100%)
Successfully installed childprocess-0.3.9
Fetching: websocket-1.0.7.gem (100%)
Successfully installed websocket-1.0.7
Fetching: selenium-webdriver-2.32.1.gem (100%)
Successfully installed selenium-webdriver-2.32.1
Fetching: watir-webdriver-0.6.3.gem (100%)
Successfully installed watir-webdriver-0.6.3
Fetching: watir-4.0.2.gem (100%)
Successfully installed watir-4.0.2
Parsing documentation for commonwatir-4.0.0
Installing ri documentation for commonwatir-4.0.0
Parsing documentation for multi_json-1.7.2
Installing ri documentation for multi_json-1.7.2
Parsing documentation for rubyzip-0.9.9
Installing ri documentation for rubyzip-0.9.9
Parsing documentation for ffi-1.7.0-x86-mingw32
Installing ri documentation for ffi-1.7.0-x86-mingw32
Parsing documentation for childprocess-0.3.9
Installing ri documentation for childprocess-0.3.9
Parsing documentation for websocket-1.0.7
Installing ri documentation for websocket-1.0.7
Parsing documentation for selenium-webdriver-2.32.1
unable to convert “\xE0″ from ASCII-8BIT to UTF-8 for lib/selenium/webdriver/fir
efox/native/linux/amd64/x_ignore_nofocus.so, skipping
unable to convert “\xB0″ from ASCII-8BIT to UTF-8 for lib/selenium/webdriver/fir
efox/native/linux/x86/x_ignore_nofocus.so, skipping
unable to convert “\xDA” from ASCII-8BIT to UTF-8 for lib/selenium/webdriver/saf
ari/resources/SafariDriver.safariextz, skipping
Installing ri documentation for selenium-webdriver-2.32.1
Parsing documentation for watir-webdriver-0.6.3
Installing ri documentation for watir-webdriver-0.6.3
Parsing documentation for watir-4.0.2
Installing ri documentation for watir-4.0.2
Done installing documentation for commonwatir, multi_json, rubyzip, ffi, childpr
ocess, websocket, selenium-webdriver, watir-webdriver, watir (141 sec).
9 gems installed
and then install – gem install watir-webdriver
it should be -
C:\Users\tanmay>gem install watir-webdriver
Successfully installed watir-webdriver-0.6.3
Parsing documentation for watir-webdriver-0.6.3
Done installing documentation for watir-webdriver (5 sec).
1 gem installed
now back to eclipse, and write sample code -
require’watir’
require’watir-webdriver’
begin
$browser = Watir::Browser.new :firefox
$browser.goto(‘http://www.google.com’)
sleep(10)
$browser.close
end
Now right click on the script and run it as script
And it will show the desired out put (open firefox browser with google page)
Now your eclipse is ready for WATiR. Please feel free to share your valuable feedback.
Thank you..
Source: http://tanmaysarkar.com/watir-installation-with-eclipse/