.

Watir Cheat sheet

 

ie = Watir::Browser.new
ie.goto(‘http://www.bitlinkit.com‘)

if ie.h1(:text, ‘System Management’).exists?
 puts ‘it exists’
end

assert(ie.text.include?(“hello world”))

ie.speed = :fast

  

checks if a radio button is set:

xx=@b.radio(:id, /ctl00_MainContent_ClinicDataEntry1_YesNoFirstAttendance_0/ )
puts (‘isSet?’)
puts (xx.isSet?)
puts (‘checked?’)
puts (xx.checked?)
puts (‘getState’)
puts (xx.getState)
#they all give the same result
# other objects: .class_name .exists? .enabled?

———————

text_field:
.class_name (not sure if exists)
.exists? .enabled? .value .verify_contains(“Hello World”) .readonly? .append(“Some Text”) .set(“pass”) .id .name .disabled .type .title .maxlength

assert_raises(ObjectReadOnlyException) { browser.text_field(:id, “readOnly2″).append(“Some Text”) } 
    assert_raises(ObjectDisabledException) { browser.text_field(:name, “disabled”).append(“Some Text”) } 
    assert_raises(UnknownObjectException) { browser.text_field(:name, “missing_field”).append(“Some Text”) } 

 

———————-

browser.button(:value, “Clear Events Box”).click

————————

select_list (dropdowns)

    assert_equal(['Option 3'], browser.select_list(:name, “sel1″).getSelectedItems)
    browser.select_list(:name, “sel1″).set(‘Option 2′)
    assert_equal(['Option 2'], browser.select_list(:name, “sel1″).getSelectedItems)

browser.select_list(:name, “sel1″).option(:text, /missing/).select
browser.select_list(:name, “sel3″).select_value(/2/)

.clearSelection .class_name .select .selected

assert browser.select_list(:name, ‘sel1′).includes?(‘Option 1′)
assert browser.select_list(:name, ‘sel1′).selected?(/option/i)
assert(@b.select_list(:id, “ctl00_MainContent_ClinicDataEntry1_List_Antibiotics_Gonorrohoea_AntibioticsDropDown1″).includes?(“Cefoxitin”))
@b.select_list(:id, “ctl00_MainContent_ClinicDataEntry1_List_Countries1_CountriesDropDown1″).set(“Bolivia”)

————————

browser.checkbox(:name, “noName”).isSet?
.clear .getState .set .locate .flash

————————

talbes:

assert(@b.table(:id, ‘ctl00_MainContent_ClinicDataEntry1_List_Antibiotics_Gonorrohoea_GridView1′).text.include?(‘Cefoxitin’))

 

————————

images:
@b.image(:id, “ctl00_MainContent_ClinicDataEntry1_List_Antibiotics_Gonorrohoea_ImageButtonCreate”).click

————————

.innerText -?

assert(browser.text.include?(“PASS”))

 

b.select_list(:id => "entry_6").option(:index, 2).select
puts b.select_list(:id => "entry_6").selected_options #Internet Explorer
puts b.select_list(:id => "entry_6").value #Internet Explorer

————————

block comments:

=begin
 this is a block comment
 make sure the next line is completely left indented !!

=end

————————

 

——————————————

Assertions

assert
assert_block
assert_equal
assert_in_delta
assert_instance_of
assert_kind_of
assert_match
assert_nil
assert_no_match
assert_not_equal
assert_not_nil
assert_not_same
assert_nothing_raised
assert_nothing_thrown
assert_operator
assert_raise
assert_respond_to
assert_same
assert_send
assert_throws
—————————-

Ways Available To Identify HTML Element:
http://wiki.openqa.org/display/WTR/Ways+Available+To+Identify+HTML+Element

references:
basic tutorial
unit testing
cheatsheet
tutorials
examples
ruby-watir-API
watir-containers
watir-methods support

automated testing:
selenium

cubic test

supported methods
ook supported stuff

source code of test scripts:
C:\Ruby192\lib\ruby\gems\1.9.1\gems\watir-2.0.2\unittests

 

installing cubic test:
http://www.cubictest.org/installDetails.html
get java 5 – so i got

Java SE Development Kit 5.0u22
from http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase5-419410.html#jdk-1.5.0_22-oth-JPR

i downloaded:

Windows Offline Installation 53.20 MB jdk-1_5_0_22-windows-i586-p.exe

and Eclipse IDE for Java Developers

http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip

link: eclipse-java-indigo-SR1-win32-x86_64.zip

watir for .net: http://watin.org/

What's your thoughts on this?

*

Protected by WP Anti Spam