Since they're short examples
Can you throw your features file and the step_definition files into the
thread
When in doubt refactor
When /^I add (.*) to the search box$/ do |item|
@browser.text_field(:name = 'j_username').set( item)
end
to supply a value you know works, like
When /^I add (.*) to the search box$/ do | item |
@browser.text_field(:name = 'j_username').set( 'Cats')
end
Because if that works then we know its a relation between features and the
| item |
On Monday, March 18, 2013 1:41:55 PM UTC-5, luca.f...@gmail.com 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
tdUsername:nbsp;/td
tdinput type=text id=j_username name=j_username /td
/tr
tr
tdPassword:nbsp;/td
tdinput type=password name=j_password id=j_password
/td
/tr
tr
td colspan=2 align=leftinput 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.
watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com
---
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 watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.