Here is some code that I am experimenting with for filling in forms using
YAML. The data in MyDataFile.yml drives which fields, select lists, etc. are
set and the values for each. The names used in MyDataFile.yml are the
element ids. Different data comes from using different data files.
Comments are appreciated! :-)
-------------------------------------------------
Example.rb
-------------------------------------------------
datafile = 'MyDataFile.yml'
testdata = YAML.load(File.open(datafile))
page = 'MyPageReference' # Reference for page and data
$ie.div(:id, page).click # I click a div for my page
tfields = testdata[page]['text_fields']
tfields.each do |tf|
$ie.text_field(:id, tf[0]).set(tf[1])
end
slists = testdata[page]['select_lists']
slists.each do |sl|
$ie.select_list(:id, sl[0]).select(sl[1])
end
-------------------------------------------------
MyDataFile.yml
-------------------------------------------------
MyPageReference:
text_fields:
name: John Doe # 'name' is the text field id
city: Los Angeles
state: CA
select_lists:
enabled: 'Y'
display: 'OFF'
... etc.
-------------------------------------------------
Sean
--
http://testmethods.net/
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general