This code is from example of openqa.org, I just ran the code without problem
( WinXp+IE6), so I think it might related with Vista or IE(7?)'s setting.



-r



On Fri, Jun 19, 2009 at 11:00 AM, Pato Coronel <[email protected]>wrote:

>
> Hi!
> I'm new with Watir and Ruby. I'm trying to learn to use the tool and
> to program using Ruby too...
> I have a laptop with Windows Vista and using Ruby-186-26.
> The only thing I have done is to copy an example about a google search
> using SctIE editor and saving it with .rb extension.
> This is the code:
>
> #-------------------------------------------------------------#
> # Demo test for the Watir controller.
> #
> # Purpose: to demonstrate the following Watir functionality:
> #   * entering text into a text field,
> #   * clicking a button,
> #   * checking to see if a page contains text.
> # Test will search Google for the "pickaxe" Ruby book.
> #-------------------------------------------------------------#
>
> # the Watir controller
> require "watir"
>
> # set a variable
> test_site = "http://www.google.com";
>
> # open a browser
> browser = Watir::Browser.new
>
> # print some comments
> puts "Beginning of test: Google search."
>
> puts " Step 1: go to the test site: " + test_site
> browser.goto test_site
>
> puts " Step 2: enter 'pickaxe' in the search text field."
> browser.text_field(:name, "q").set "pickaxe" # "q" is the name of the
> search field
>
> puts " Step 3: click the 'Google Search' button."
> browser.button(:name, "btnG").click # "btnG" is the name of the Search
> button
>
> puts " Expected Result:"
> puts "  A Google page with results should be shown. 'Programming Ruby'
> should be high on the list."
>
> puts " Actual Result:"
> if browser.text.include? "Programming Ruby"
>  puts "  Test Passed. Found the test string: 'Programming Ruby'.
> Actual Results match Expected Results."
> else
>  puts "  Test Failed! Could not find: 'Programming Ruby'."
> end
>
> puts "End of test: Google search."
>
> The problem is that when executing this code, I got the following
> error:
>
> C:\Users\Pato\Documents>ruby pruebaruby.rb
> Beginning of test: Google search.
>  Step 1: go to the test site: http://www.google.com
>  Step 2: enter 'pickaxe' in the search text field.
> 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::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 pruebaruby.rb:27
>
> At the same time it is executing, the new window of the browser is
> opened as requested in the code, but it is a blank window and a
> message is displayed about security in the zones are different so it
> is necessary to open the url in a different window. Then a new second
> browser window is opened and the code stops to respond and the pasted
> error message is displayed.
> I have verified the IE browser properties and there is something
> calling my attention:
> The first window browser that the codes open says "Protected mode
> deactivated"
> The second one that it is displayed after confirming the security
> message says "Protected mode activated"
> I think that I have any property in the IE that it is not working
> fine. I have set the security properties to the default value and this
> didn't solve the issue.
> Could someone help me to solve this? I'm new with this and don't know
> how to solve it.
> Thanks a lot!
>
> >
>


-- 
Best Regards, Let me know if I can help.

Ray
-----------------------
Enrich your cube life
www.myvpsoft.com
www.3wgift.com
screenshots:  http://picasaweb.google.com/sunraise2005

Get our FTP Account:
http://61.152.188.156:880/viewthread.php?tid=11&extra=page%3D1


+01-(408)556-9618

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

Reply via email to