I am receiving the following error:

  1) Error:
test_a_order_now(TC_S001):
NoMethodError: undefined method `link' for nil:NilClass
    Story001_set.rb:50:in `test_a_order_now'

 
<Error is on the verify statement near the end>

###########################################################################################

require 'watir'
require "watir/testcase"


class TC_S001 < Watir::TestCase

 def test_a_order_now

   #variables
   test_site = 'https://www.mysite.com'

   #open a browser
   $browser = Watir::Browser.new

   puts '## Beginning of test: Order'
   puts '  '

   puts 'Step 1: go to the site'
   $browser.goto(test_site)
   puts '  Action: entered ' + test_site + ' in the address bar.'

   puts 'Check for Security Warning'
   if $browser.text.include? "Continue to this website (not
recommended)."
      puts 'Security Warning found'
    $browser.link(:text, "Continue to this website (not
recommended).").click
      puts 'Clicked Continue on Security Warning'
    end

   verify((@browser.link(:text, "some text").exists?), message="Field
not active.")
   $browser.link(:text, "some text").click

   puts '  '
   puts '## End of test: Order Now'

 end # end of test_order_now

###########################################################################################

On Feb 10, 2:42 pm, Matt <thurman_m...@yahoo.com> wrote:
> Hi,
>
> I am new to Watir and trying to figure out the best way to go about
> validating my AUT. I started out by using the assert method for text
> checks but do not like that it exits when there is a failure and does
> not execute the following statements. So my questions are:
>
> How is the verify method used?
> Can I check for objects, properties, text, etc with verify? (need to
> check for the existence of objects)
> Which libraries need to be loaded?
>
> I added 'require "watir/testcase" ' as directed in another post and it
> did not work. I was using it like this:
>
> verify($browser.text.include?("Order Now") )
>
> best practices for reporting to test results?
>
> Thanks!
>
> Matt

-- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general

Reply via email to