[Wtr-general] Syntax for relative attributes
Bret Pettichord
bret at pettichord.com
Tue Jan 9 03:38:33 EST 2007
Christian Kreutzer wrote:
> On 12/22/06, Bret Pettichord <bret at pettichord.com> wrote:
>
>
>> So we have consistently urged people to wrap their watir expressions in
>> methods rather than assign them to global variables. This makes it easy
>> to reuse them, and ensure that a correct rebinding occurs on each reuse.
>> Also, as i have been using Watir more on large projects, i am finding
>> that there are other reasons why this is a sound way to structure Watir
>> libraries.
>>
>
> im not sure if i understand this correctly.
>
> text = $ie.text <-- so, this is bad because we cant be sure if the
> rebinding happens just in time when we need it.
>
>
No. The advice applies to Watir objects, the things that are returned by
expressions like $ie.button(:id, 'foo') -- in this a Watir::Button
object. Your example ($ie.text) just returns a string, which is
unproblematic.
I guess you could say that $ie is a watir object, but that wasn't what i
was talking about.
Clear as mud, i know.
Bret
More information about the Wtr-general
mailing list