T
TJ Wilkes
Hi I've been learning Ruby to help with scripting some tests, but the
books I have are only using mathematical method/class creations and my
attempts to make my own methods are failing. Looking for some help with
the creation of two time savers.
Note: Using ruby 1.8.7 and Watir-webdriver as well as IE 9.
I'm trying to set up some page validation scripts but every attempt has
failed, these run prefectly fine in the program if I repeat them and
fill in linkX and PagetextX with specfics each time but i'd prefer to be
able to run each with a simple bit of code calling the function.
Such as: verify.LinkX("Terms")or verify.LinkX(href/ID/etc, "Terms")
#which would validate a link called Terms.
and verify.PagetextX("Your info is important").
Thanks for any help or direction,
TJ
Code samples below.
#First process--------------------------
puts "\n"
puts "Verifying (linkX)."
ie.linkid, "(linkX)").exist?
print "Actual Result:"
if ie.text.include? "(linkX)"
puts " Test Passed. Found: 'LinkX'. Actual Results match expected
Results."
else
puts " Test Failed! Could not find: 'LinkX'."
end
ie.linkhref, /(linkx)/).click
#Second process-------------------------------
puts "\n"
puts "Checking for Page text '(PagetextX)'."
ie.text.include? "Govern Your Use of Our Site"
print "Actual Result:"
if ie.text.include? "(PagetextX)"
puts " Test Passed. Found the test string: '(PagetextX)'. Actual
Results match expected Results."
else
puts " Test Failed! Could not find: '(PagetextX)'."
end
books I have are only using mathematical method/class creations and my
attempts to make my own methods are failing. Looking for some help with
the creation of two time savers.
Note: Using ruby 1.8.7 and Watir-webdriver as well as IE 9.
I'm trying to set up some page validation scripts but every attempt has
failed, these run prefectly fine in the program if I repeat them and
fill in linkX and PagetextX with specfics each time but i'd prefer to be
able to run each with a simple bit of code calling the function.
Such as: verify.LinkX("Terms")or verify.LinkX(href/ID/etc, "Terms")
#which would validate a link called Terms.
and verify.PagetextX("Your info is important").
Thanks for any help or direction,
TJ
Code samples below.
#First process--------------------------
puts "\n"
puts "Verifying (linkX)."
ie.linkid, "(linkX)").exist?
print "Actual Result:"
if ie.text.include? "(linkX)"
puts " Test Passed. Found: 'LinkX'. Actual Results match expected
Results."
else
puts " Test Failed! Could not find: 'LinkX'."
end
ie.linkhref, /(linkx)/).click
#Second process-------------------------------
puts "\n"
puts "Checking for Page text '(PagetextX)'."
ie.text.include? "Govern Your Use of Our Site"
print "Actual Result:"
if ie.text.include? "(PagetextX)"
puts " Test Passed. Found the test string: '(PagetextX)'. Actual
Results match expected Results."
else
puts " Test Failed! Could not find: '(PagetextX)'."
end