[Wtr-general] Unable to click on links with the same text

Angrez Singh angrez at gmail.com
Mon Jul 2 07:06:46 EDT 2007


Try this:

ie.link(:href, "bcd").click

- Angrez

On 7/2/07, Lavanya Lakshman <forum-watir-users at openqa.org> wrote:
>
> 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 at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070702/0d32a497/attachment-0001.html 


More information about the Wtr-general mailing list