On 14 May 2012 14:37, Chuck van der Linden <[email protected]> wrote: > > > On Wednesday, May 9, 2012 5:33:11 AM UTC-7, cassiano wrote: >> >> Got it to work! >> >> I had forgotten to take away the constructors of my original page >> classes, so the PageOpbject's was never being called. :) > > > Glad to hear you got it working. Stuff like this is always frustrating > and I know I want to kick myself when I find where I went wrong. > > When something works in individual pieces, but not in some object I'm > trying to define, I find it's usually my fault, something I constructed > wrong in my object, or didn't initialize correctly or somesuch, and not a > problem with watir. > > If it works in the pieces from IRB but not with the very same commands in > a script, it's usually timing or syncing due to ajax or a lot of client > side magic happening after a page loads or after specific actions. > > Not sure how much we were able to help you other than perhaps in the > process of trying to explain it to us, you realized where the problem was > (e.g. the rubber plant effect) >
To be honest, I'm not sure myself. I know that without the help and encouragement (usually in the form of "I don't see a reason why this shouldn't work in that situation"... lol), I would probably have quit trying and just do it the manual way. The one thing I didn't quite understand is the need for 'self.' before some of the page-object methods when called from within an instance method. I mean... doesn't self always mean the current object? In this case, doesn't self inside an instance method always refers to the object itself, making it redundant? In other words, shouldn't I be able to call any instance method from within another instance method of the same class without the need to explicitly call it on self? An example of such behaviour is on my 4th reply to this thread. Even though I now know that in some cases I have to throw a 'self.' before the method call, I'm still unable to understand why. Any ideas? -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. [email protected] http://groups.google.com/group/watir-general [email protected]
