The error message is saying that it can't find the text field with the
name 'q'.  For some reason, it doesn't exist in the browser contained
by your variable ie.  Are you sure that your browser is on the page
you think it is?

One way to troubleshoot this is with an irb session.  Run your test
and when it fails, open an irb session in a command prompt.  Then try
the following commands:

require 'watir'
ie = Watir::IE.find(:title, /Google/)
ie.text_field(:name,'q').exists?

I've copied both of your scripts into an irb session and they ran
without any problems - even without the sleep commands (you shouldn't
need those).  Try stepping through your scripts, line by line in irb
so you can watch what happens in with each step.

Hope this helps,

-Tiffany



On Nov 12, 7:42 am, tester86 <sagar.am...@gmail.com> wrote:
> Hi,
>
> When I try run any script I still get the following error message:
>
> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/element.rb:52:in
> `assert_ex
> ists': Unable to locate element, using :name,
> "q" (Watir::Exception::UnknownObjectException)
>         from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> element.rb:284:in `enabled?'
>         from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> element.rb:56:in `assert_enabled'
>         from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> input_elements
> .rb:323:in `set' from script2.rb:6
>
> Here is my script:
>
> require 'watir'
> ie = Watir::IE.new
>
> ie.goto("http://www.google.com";)
> sleep(10)
> ie.text_field(:name,"q").set("watir")
> sleep(10)
>
> Here is my other scripts:
>
> #require 'rubygems'
> require 'watir'
>
>    # set a variable
>    test_site = 'http://www.google.com'
>
>    # open the IE browser
>    ie = Watir::IE.new
>
>    puts "Step 1: go to the test site: " + test_site
>    ie.goto(test_site)
>    puts "  Action: entered " + test_site + " in the address bar."
>
>    puts "Action: WaitForPageToLoad"
>
>    sleep(10)
>
>    #puts "Click on the Gmail Link"
>
>    #ie.link(id, '').click
>
>    #puts "Action: Enter InfoQ into text box"
>    ie.text_field(:name,"q").set("watir")
>    sleep(10)
>    #puts "Action: Click Search Button"
>    #ie.button(:name, "btnG").click
>
> As far as I know my script should be fine as I am following the watir
> commans correctly but everytime I execute the script I get the error
> mentioned above.
>
> Thanks
>
> On Nov 11, 6:13 pm, Raveendran P <jazzezr...@gmail.com> wrote:
>
> > Hi,
>
> > Please try to use slep(10) commands.
>
> > It means
>
> > ie.goto("htp://google.com")
> > sleep(10)
> > ie.text_field(:name,"q").set("Raveendran")
> > sleep(10)
> > .
> > .
> > .
> >  I hope it works now. Rit ?
>
> > On Thu, Nov 12, 2009 at 12:48 AM, tester86 <sagar.am...@gmail.com> wrote:
>
> > > Another Error From Command Prompt:
>
> > > ## Beginning of test: Google search
> > > Step 1: go to the test site:http://www.google.com
> > >  Action: enteredhttp://www.google.cominthe address bar.
> > > Action: WaitForPageToLoad
> > > c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/element.rb:52:in
> > > `assert_exists': Unable to locate element, using :name,
> > > "q" (Watir::Exception::UnknownObje
> > > ctException)
> > >        from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> > > element.rb:284:in `enabled?'
> > >        from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> > > element.rb:56:in `assert_enabled'
> > >        from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> > > input_elements.rb:323:in `set'
> > >         from script1.rb:28
>
> > > I never had any problems when I was using watir on windows xp, I am
> > > not 100% sure but is there any configuration for windows vista or any
> > > known issue because when using IE Developer Toolbar I am able to find
> > > the link "q" on the page........
>
> > > On Nov 11, 12:49 pm, tester86 <sagar.am...@gmail.com> wrote:
> > > > Bret,
>
> > > > My script is going to the google URL, but for some reason it cannot
> > > > find the text box. I have tried all the examples but I get the
> > > > following output:
>
> > > > broswer.url
> > > > browser.text
> > > > script1.rb:9: undefined method `enter_text' for #<Watir::IE:0x8b291e0>
> > > > (NoMethodError)
>
> > > > same for when I use ie.text_field(:name, "q").set("pickaxe")
>
> > > > Do you have any idea why it cannot find that text box?
>
> > > > On Nov 10, 1:09 pm, Bret Pettichord <b...@pettichord.com> wrote:
>
> > > > > My guess is that the browser is not actually on the google page at 
> > > > > this
> > > > > point. You could use statements like this to help troubleshoot:
>
> > > > >   puts browser.text
> > > > >   puts browser.url
> > > > >   puts browser.title
>
> > > > > Bret
>
> > > > > tester86 wrote:
> > > > > > Thanks for all the help I managed to get ruby and watir all up and
> > > > > > running. But I have a question, when I was using cucumber I get this
> > > > > > error message and they told me to put this post in the watir group:
>
> > > > > > c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/element.rb:52:in
> > > > > > `assert_exists': Unable to locate element, using :name,
> > > > > > "q" (Watir::Exception::UnknownObje
> > > > > > ctException)
> > > > > >       from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> > > > > > element.rb:284:in `enabled?'
> > > > > >         from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> > > > > > element.rb:56:in `assert_enabled'
> > > > > >         from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> > > > > > input_elements.rb:323:in `set'
> > > > > >         from script1.rb:8
>
> > > > > > When you have a watir script why cannot find the text box and the
> > > > > > search box for google.My script is still the same. Is there some
> > > other
> > > > > > syntax that I need to use?
>
> > > > > --
> > > > > Bret Pettichord
> > > > > Lead Developer, Watir,www.watir.com
> > > > > Blog,www.io.com/~wazmo/blog<http://www.io.com/%7Ewazmo/blog>
> > > > > Twitter,www.twitter.com/bpettichord-Hidequotedtext -
>
> > > > > - Show quoted text -- Hide quoted text -
>
> > > > - Show quoted text -
>
> > --
> > Regards,
> > P.Raveendranhttp://raveendran.wordpress.com-Hide quoted text -
>
> > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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