> -----Original Message-----
> From: watir-general@googlegroups.com [mailto:watir-
> gene...@googlegroups.com] On Behalf Of Bill Mosteller
> Sent: Tuesday, June 16, 2009 7:49 AM
> To: Watir General
> Cc: arti.si...@eloqua.com
> Subject: [wtr-general] Why Do Exists? Exceptions Occur?
> 
> 
> A little loop to run through a Hotmail inbox (line 59 is the if
> statement):
> 
> puts TimeStr() + "Back from in-box click"
> sleep(1)
> 
> (1..20).each do |x|
>       inboxrow = $ie.frame(:id, 'UIFrame').table(:class, 'InboxTable').row
> (:index, x).cell(:class, 'Sbj')

I believe that the line above is where your exception is happening, and it
never reaches the .exist? test below.

If it can't find a row with :index of 13, then it is going to have trouble
finding a cell on that row.

I tend to overproof my code, confirming that each item in a chain exists so
that if the table isn't there, I get the error at the table level.

Let me know if you need additional help.

>       if inboxrow.exist? then
>       puts TimeStr() + x.to_s + " " + inboxrow.text
>       else
>       puts TimeStr() + "No row " + x.to_s
>       break
>       end # if inboxrow.exist?
>       end # each
> 
> The output:08:45:25 Back from in-box click
> 08:45:26 1 FW: * TEST * 20090615HTMLEmail - Friend * TEST *?
> 08:45:26 2 20090609HTMLEmail - Friend?
> 08:45:26 3 20090609HTMLEmail - Friend?
> 08:45:26 4 ECS Automation?
> 08:45:26 5 ECS Automation?
> 08:45:27 6 ECS Automation?
> 08:45:27 7 ECS Automation?
> 08:45:27 8 Welcome to Eloqua Conversion Suite?
> 08:45:27 9 sub?
> 08:45:27 10 Hotmail gives you more than just email in May?
> 08:45:27 11 "Check this out! You roc...@#$*"?
> 08:45:27 12 la di da?
> 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 :index, 13
> (Watir::Exception::UnknownObje
> ctException)
>         from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> element.rb:126
> :in `document'
>         from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> locator.rb:31:
> in `each_element'
>         from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> locator.rb:38:
> in `locate'
>         from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> container.rb:7
> 49:in `locate_tagged_element'
>         from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> table.rb:328:i
> n `locate'
>         from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> element.rb:273
> :in `exist?'
>         from C:/QA/ECS_Tests/HotWatir.rb:59
>         from C:/QA/ECS_Tests/HotWatir.rb:57:in `each'
>         from C:/QA/ECS_Tests/HotWatir.rb:57
> 
> So what good is exists?; I know how to fix this, I replace
> the .exists?  with a begin/rescue/end bracket, but that seems like a
> lot of trouble when I would have expected exists? to have simply said
> "no."
 

__________ Information from ESET NOD32 Antivirus, version of virus signature
database 4160 (20090616) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 



--~--~---------~--~----~------------~-------~--~----~
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