Watir Script has some issue with Classic Gem

Sophia's Avatar


13 Jun, 2012 05:15 AM

Hi I'm new to Ruby and Watir
I have installed Ruby1.9.3 and Watir3.0.0.
This is my Ruby Script

require 'rubygems'
require 'watir'
browser = Watir::IE.new
browser.goto 'http://google.com'
puts 'Opened Browser'
browser.text_field(:name, 'q').set "Watir"
puts 'Entered Search Text'
browser.button(:name, 'btnG').click
puts 'Search button'
puts time
browser.link(:text, 'Watir').click

C:\Ruby193\bin>ruby googlesearch.rb
Opened Browser
Entered Search Text
Search button
2012-06-13 10:40:16 +0530
t.rb:66:in `assert_exists': Unable to locate element, using {:tag_name=>["a"], :
text=>"Watir"} (Watir::Exception::UnknownObjectException)

    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-c

lassic/element.rb:414:in `perform_action'

    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-c

lassic/element.rb:269:in `click!'

    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-c

lassic/element.rb:211:in `click'

    from googlesearch.rb:13:in `<main>'

I dont know whats happening please help...

  1. 1 Posted by Sophia on 13 Jun, 2012 05:42 AM

    Sophia's Avatar

    Hi.... Can anyone tell me what the problem is??? Why was it closed???

  2. 2 Posted by Luis Lavena on 13 Jun, 2012 12:06 PM

    Luis Lavena's Avatar

    Your question is about watir, while this website provides support for
    rubygems and rubygems.org, not gems.

    Please direct your questions yo watir developers.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac