[Wtr-general] for loop syntax??

Charley Baker charley.baker at gmail.com
Wed Jul 19 10:43:20 EDT 2006


Your loop is 0-9 which is 10, your arrays are only 9 items long. You've
overshot it by one.

for x in 0..8 do
.......

-Charley

On 7/19/06, Cain, Mark <Mark_Cain at rl.gov> wrote:
>
> You will need to these:
>
> require 'test/unit'
> require 'test/unit/ui/console/testrunner'
> require 'watir/testUnitAddons'
> require 'watir/testcase'
>
> I usually add the setup.rb from the unittest directory instead because
> these requires are already in it.
>
> --Mark
>
> -----Original Message-----
> From: wtr-general-bounces at rubyforge.org
> [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of mi
> Sent: Tuesday, July 18, 2006 4:23 PM
> To: wtr-general at rubyforge.org
> Subject: [Wtr-general] for loop syntax??
>
> Hi all,
>
> I'm using a for loop to access arrays to fill  all the text fields in my
>
> forms.  For some reason, i'm getting the following error at the end of
> the for loop execution???
> c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:1928:in `assert_exists': Unable
> to locate object, using name and
> (Watir::Exception::UnknownObjectException)
>     from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:3382:in `set'
>     from c:/ruby/lib/ruby/site_ruby/1.8/watir/watir_simple.rb:402:in
> `fill_text_field'
>     from SmokeTest.rb:25
>     from SmokeTest.rb:24
>
>
> Thanks in advance!
>
> <<<<<my code....>>
>
> require 'watir'   # the watir controller\
> require 'watir/watir_simple'
> include Watir
> include Watir::Simple
>
> Simple1 = Simple
>
> test_site = 'http://dev01.pheedo.com'
> pubInfoTextFields =  ['user', 'email', 'password', 'repass', 'url',
> 'ssn', 'payment_address', 'payment_city', 'payment_zip']
> pubInfo =  ['pubUserName', 'mdove at pheedo.com', '1', '1',
> 'http://www.test.com', '1234', '123 st', 'some city', '97035']
> #[user name, emaildAdd, passwd1, passwd2, yourSite, TaxID, StreetAdd,
> CityName, State, ZipCode]
>
> Simple1.new_browser_at(test_site)
> Simple1.click_link_with_text("Sign up now")  #same as
> Simple::click_link_with_text("Sign up now")
>
> #click on Publisher's sign up page
> Simple1.click_link_with_url(test_site+"/register.phdo?mode=publish")
>
> #Enter all the required fields
> x=0
> for x in 0..9 do
>   Simple1.fill_text_field(pubInfoTextFields[x], pubInfo[x])
>   puts "pubInfoTextFields = "+pubInfoTextFields[x]+"   pubInfo =
> "+pubInfo[x]
> end
>
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060719/0a9c6244/attachment.html 


More information about the Wtr-general mailing list