That explains it. Thanks for the quick answer. No good deed goes
unpunished, so:

The Rdoc for contains_text
(http://wtr.rubyforge.org/rdoc/classes/Watir/IE.html#M000294) does say
"Returns true if the specified text was found." Is that wrong?

Why were my asserts passing when receiving an index (i.e. a number
string) rather than "true"?

-D

Date: Wed, 9 Nov 2005 16:31:28 -0800
From: Jeff Wood <[EMAIL PROTECTED]>
Subject: Re: [Wtr-general] IE.contains_text and assert
To: [email protected]
Message-ID:
        <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="iso-8859-1"

contains_text returns the index where the text was found or nil when
it's not..

try

assert( ie.contains_text( "abcd" ) != nil )

j.


On 11/9/05, Dara Lillis <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I'm relatively new to Watir and am having some problems with asserts 
> on IE.contains_text, hoping for some enlightenment.
>
> Basically, my problem is as follows; I have some code that says
> (essentially):
>
> assert(ie.contains_text("abcd"))
>
> This seems to work ok when "abcd" is present, but fails (and causes my

> test to stop running) when "abcd" is not present. The reason for the 
> failure seems to be that ie.contains_text returns <nil> rather than
"false"
>
> In attempting to find out what is going on I've been outputting the 
> result of ie.contains_text to the console and notice that when "abcd" 
> is present (and the assert passes) the returned value of contains_text

> is "522" when I was expecting "true"
>
> I'm finding this all a bit confusing. Can someone explain it to me?
>
> Thanks,
>
> -Dara
>
> _______________________________________________
> Wtr-general mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/wtr-general
>
>
>


--
"Remember. Understand. Believe. Yield! -> http://ruby-lang.org";

Jeff Wood
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://rubyforge.org/pipermail/wtr-general/attachments/20051109/901eb852
/attachment.htm

------------------------------

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general


End of Wtr-general Digest, Vol 24, Issue 12
*******************************************


_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to