From: Rubenson Crusoe Date: 2007-10-24T22:25:19+09:00 Subject: Re: Watir and Inheritance ------=_Part_7652_507118.1193232319963 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I think Jesus' approach is correct. It only missed the initialization of th= e super class: class Navigator =3D> "http://www.google.es/" /Rub=E9n On 10/24/07, Kyle Schmitt wrote: > > 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=FAs Gabriel y Gal=E1n wrote: > > On 10/23/07, Mario Ruiz wrote: > > > I'm trying to do this: > > > ----------------------------- > > > require 'Watir' > > > > > > class Navigator > > def initialize(maxim) > > > @maxim=3Dmaxim > > > @iex=3DWatir::IE.new > > > end > > > def go(url) > > > @iex.goto(url) > > > if @maxim=3D=3D1 then > > > @iex.maximize() > > > end > > > end > > > end > > > > > > naveg=3DNavigator.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=3Dmaxim > > end > > def go(url) > > goto(url) > > if @maxim=3D=3D1 then > > maximize() > > end > > end > > end > > > > naveg=3DNavigator.new(1) > > naveg.go("http://www.google.es") > > > > puts naveg.url > > > > Hope this helps, > > > > Jesus. > > > > > > ------=_Part_7652_507118.1193232319963--