Following is my sample script :
<html>
<head>
<title>Title of page</title>
</head>
<body>
This is my first homepage. <b>This text is bold</b>
<a href="url">Text to be displayed</a>
<a href="bcd">Text to be displayed</a>
</body>
</html> 


Now as per Watir syntax, I am trying to click on link 2: 
# This allows test script to use Watir tool
require 'watir'
require 'watir/watir_simple.rb'
include Watir
include Test::Unit::Assertions
ie = Watir::IE.attach(:title, "Title of page")
ie.link(:text => 'Text to be displayed', :index  => 2).click


Upon execution, I am getting the following error:
c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:963:in `getLink': {:index=>2, :text=>"Te
xt to be displayed"} is an unknown way of finding a link (  ) 
(Watir::Exception::MissingWayOfFindingObjectException)
        from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2830:in `initialize'
        from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:570:in `new'
        from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:570:in `link'
        from E:/PROVIS/sample.rb:10
_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to