install firewatir on ubuntu 10.04

July 12th, 2010 Comments off

I am a newbie with ubuntu, I tried and failed several times to install firewatir on ubuntu 10.04, and finally got following codes by google:

sudo su
apt-get install build-essential
apt-get install ruby rdoc libopenssl-ruby
wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz
tar zxvf rubygems-1.3.7.tgz
cd rubygems-1.3.7
ruby setup.rb
ln -s /usr/bin/gem1.8 /usr/local/bin/gem
gem install firewatir

Frankly I did not understand the function of the first 2 apt-get, I just copy it for free.

Categories: wordpress Tags:

The poor support of the firewatir 1.6.5 to Chinese characters

January 7th, 2010 leleba No comments

I cannot figure out how to enter the Chinese characters into the textfield of a webpage by firewatir 1.6.5, I tried to change the encoding of the .rb file and the encoding of the firefox browser, but failed.

require ‘rubygems’
require ‘firewatir’

ff = FireWatir::Firefox.new
ff.goto “http://www.google.com

sleep 1
ff.text_field(:name, ‘q’).set(‘?’)

For Watir 1.6.5, the Chinese charaters can be supported by replacing the script WIN32OLE.codepage = WIN32OLE::CP_UTF8 with WIN32OLE.codepage = WIN32OLE::CP_ACP in the file of C:\Ruby\lib\ruby\gems\1.8\gems\watir-1.6.5\lib\watir\win32ole.rb

Categories: watir Tags:

Check the version of the watir and the firewatir

January 7th, 2010 leleba No comments

We can check the version of the watir and firewatir by executing an rb file with the following script:

require ‘watir’

require ‘firewatir’

puts Watir::IE::VERSION

puts FireWatir::Firefox::VERSION

Categories: watir Tags:

It is safe require “rubygems” in the begining of the watir codes

December 28th, 2009 leleba No comments

Maybe it is safe to add the code of require ‘rubygems’ in the beginning of the watir codes, otherwise, strange results may happen sometimes .

Categories: watir Tags:

the fucntion ie.collect in watir

November 10th, 2009 No comments

Just copy a coding found in the internet for future reference,

$ie.divs.collect {|div|
if div.class_name == “data”
puts div.text
end
}

Categories: watir Tags:

The fast way to fill a textfield in watir

November 9th, 2009 No comments

It is quite slow to fill a text field by ie.text_field().set(content), the fast way is by ie.text_field().value = content.

Categories: watir Tags: