It can go into any script.. here's a cheesy example of extending a
class that you can do on the fly

1. Create a file called mainclass.rb in your working folder
2. in mainclass.rb enter
module Mymodule
 class Msg
   puts ' Hello World'
 end
end

3.  In a second file we'll extend our base class.  Create a file
extend.rb in your working folder
4. Enter in the file
require './mainclass'   # ./ so I point to my working folder
module Mymodule
 class Msg
 puts ' Hello again'
end
end

run extend.rb
the output should now be two lines
Hello World
Hello Again









On Mar 28, 4:13 pm, hillary <[email protected]> wrote:
> i found a work around that works.
>
> If i was going to use they monkeypatch, where would i put this information?
>
>
>
> On Wednesday, March 28, 2012 2:02:48 PM UTC-7, Jarmo Pertman wrote:
>
> > If it's absolutely needed then you can also add a monkeypatch for
> > yourself:
> > require "watir"
>
> > module Watir
> >   class Link
> >     attr_ole :name
> >   end
> > end
>
> > Jarmo
>
> > On Mar 28, 6:51 pm, hillary <[email protected]> wrote:
> > > i was getting the number in the #page_25 out of a database, so i just
> > added
> > > a line to get the value from the db that equals the link text. it's
> > working
> > > out.
>
> > > On Tuesday, March 27, 2012 8:38:01 PM UTC-7, Anthony Hallett wrote:
>
> > > > why not try something simple like
> > > > browser.link(:xpath, "//a[@name ='#page_25']").click
>
> > > > On Thursday, 22 March 2012 09:23:31 UTC+11, hillary wrote:
>
> > > >> I had been identifying some links by name. I upgraded to rc3 and now
> > i
> > > >> get an error.
>
> > > >> browser.link(:name, "#page_25").click
>
> > > >> Watir::Exception::MissingWayOfFindingObjectException: name is an
> > unknown
> > > >> way of finding a <a> element (#page_25)- Hide quoted text -
>
> - Show quoted text -

-- 
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]

Reply via email to