7stud -- wrote in post #997840:
> TJ Wilkes wrote in post #997808:
>> 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
>>
>
> How about an example of that?
>
>> my attempts to make my own methods are failing.
>
> We need to see an example of that too.

I've attached my working code for a short test, when manually putting
pages/links in, so you can see what I'm trying to do.

Below I've put what my first attempt for simplifying before I decided to
post a question.

I want to be able to put a method that accepts a string variable and
then runs a process using that string.


Also, thanks to everyone for responding,
-TJ


def verify(x)
print "Verifying ", v, "."
ie.link(:id, x).exist?
print "Actual Result:"
  if ie.text.include? x
  puts "  Test Passed. Found the test string: ", x, ".  Actual Results
match expected Results."
  ie.link(:href, x).click
else
  puts "  Test Failed!  Could not find: ", x, "."
end
end

Attachments:
http://www.ruby-forum.com/attachment/6185/post.rb


-- 
Posted via http://www.ruby-forum.com/.