Is the app you're testing running locally?
http://localhost:8080/examples/prova.html

On Mon, Mar 18, 2013 at 2:41 PM, <[email protected]> wrote:

> Hi all,
>
> I just installed cucumber, rspec and watir on a win7 machine (ruby 1.9.3)
> and tested it with a standard "google scenario" and everything works fine
> Then I changed the example in the following way:
>
> require "rubygems"
> require "watir"
>
> Given /^that I have gone to the Google page$/ do
>     @browser=Watir::Browser.new
>     @browser.goto("http://localhost:8080/examples/prova.html";)
> end
>
> When /^I add "(.*)" to the search box$/ do |item|
>     @browser.text_field(:name => 'j_username').set( item)
> end
>
> And /^click the Search Button$/ do
>     @browser.button(:name, "submit_button").click
> end
>
> Then /^"(.*)" should be mentioned in the results$/ do |item|
>     @browser.text.should include(item)
> end
>
> and my page is a really simple one
>
> <html>
>
> <body>
>
>
> <form id="login_form" method="post" action="j_security_check">
>
> <center>
> <table align="center" style="">
>     <tr>
>         <td>Username:&nbsp;</td>
>         <td><input type="text" id="j_username" name="j_username" ></td>
>     </tr>
>     <tr>
>         <td>Password:&nbsp;</td>
>         <td><input type="password" name="j_password" id="j_password"
> ></td>
>     </tr>
>     <tr>
>         <td colspan="2" align="left"><input type="submit"
> name="submit_button" value="Accedi"></td>
>     </tr>
> </table>
> </form>
>
>
> </body>
> </html>
>
> but there's no way I can make it work - I get:
> When I add "cats" to the search box            #
> features/step_definitions/GoogleSearch.rb:10
>   Unable to locate element, using {:tag_name=>["text", "password",
> "textarea"], :name=>"j_username"} (Watir::Exception::UnknownObjectException)
>   ./features/step_definitions/GoogleSearch.rb:11:in `/^I add "(.*)" to the
> search box$/'
>   features\GoogleSearch.feature:6:in `When I add "cats" to the search box'
>
> I also tested a scenario I got from the Watir example page but that one,
> as the google one, works great
> I must be doing something really dummy... any idea?
>
> thanks a lot!
> luca
>
>
>  --
> --
> Before posting, please read http://watir.com/support. In short: search
> before you ask, be nice.
>
> [email protected]
> http://groups.google.com/group/watir-general
> [email protected]
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Watir General" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
http://www.richdownie.com
http://github.com/richdownie

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

[email protected]
http://groups.google.com/group/watir-general
[email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to