From: Kyle Schmitt Date: 2007-10-24T21:45:16+09:00 Subject: Re: Watir and Inheritance Watir's ie object allows you to get at things like the url using public methods. Unless the idea really is extending or or replacing them, inheritance shouldn't be necessary (or probably advised). Well, that is unless the whole point is to play around with Watir to learn about it, more than get work done ;) On 10/24/07, Jesús Gabriel y Galán wrote: > On 10/23/07, Mario Ruiz wrote: > > I'm trying to do this: > > ----------------------------- > > require 'Watir' > > > > class Navigator > def initialize(maxim) > > @maxim=maxim > > @iex=Watir::IE.new > > end > > def go(url) > > @iex.goto(url) > > if @maxim==1 then > > @iex.maximize() > > end > > end > > end > > > > naveg=Navigator.new(1) > > naveg.go("http://www.google.es") > > > > puts naveg.url > > -------------------------------- > > I want my 'naveg' object can display the methods and properties of > > wakir, url for example. What am I doing wrong? > > I think what you are doing wrong is having a Watir::IE object inside > your Navigator class. If you inherit from IE you have all methods in > IE available so you don't need to wrap another instance of IE inside. > Can you try this (not tested): > > require 'Watir' > > class Navigator def initialize(maxim) > @maxim=maxim > end > def go(url) > goto(url) > if @maxim==1 then > maximize() > end > end > end > > naveg=Navigator.new(1) > naveg.go("http://www.google.es") > > puts naveg.url > > Hope this helps, > > Jesus. > >