paul
could you give us a little taster of your efforts?
aidy

On 27/03/07, Paul Rogers <[EMAIL PROTECTED]> wrote:
>
> Ive been working on some things that ( at least to my mind) simplify how the
> code represents an html page. It also has several other advantages. I'll
> probably publish it in a seperate library ( or via the contrib dir )
>
> as for your code, the firsat think i would do is get rid of the global ie.
> even replacing it with a method is better
>
> $ie = Watir::IE.new
>
> def my_browser
>     $ie
> end
>
> my_browser.goto('http://someurl')
>
>
> at least this way its a bit easier to switch to firefox, or do something
> different with the browser.
>
>
> Paul
>
>
> ----- Original Message -----
> From: aidy lewis <[EMAIL PROTECTED]>
> Date: Tuesday, March 27, 2007 9:56 am
> Subject: [Wtr-general] little framework
>
> > Hi,
> >
> > Could anyone give me some feedback on this?
> >
> > Each HTML objects exists in a module
> >
> > <snip>
> >
> >
> > module Field
> >
> >    MAP_FIELD = Hash.new {|h,k| k}.update(
> >      'username' => 'login', # gui name => HTML name
> >      'password' =>  'password'
> >    )
> >
> >  def Field.set(name,args)
> >    $ie.text_field(:name, MAP_FIELD[name]).set(args)
> >  end
> >
> >  def Field.assert(name,args)
> >    puts $ie.text_field(:name, MAP_FIELD[name]).verify_contains(args)
> >  end
> > end
> >
> > <snip>
> >
> > At the top of each module is a hash map that acts as an object map for
> > each object.The gui name is mapped to the object name
> >
> > <snip>
> >
> > MAP_BUTTON = Hash.new {|h| k}.update(
> >      'login' => 'Login'
> > )
> >
> > <snip>
> >
> > IE methods go here
> >
> > <snip>
> >
> > module Explorer
> >  def Explorer.start(url)
> >    $ie = IE.new
> >    @url=url
> >    $ie.goto(@url)
> >  end
> >
> >  def Explorer.close
> >    $ie.close
> >  end
> > end
> >
> > <snip>
> >
> > Each test will be in a class
> >
> > <snip>
> >
> > class TestClass
> >
> >  def test_1
> >
> >    Explorer.start 'http://aidy_server.com/'
> >    Field.set  'username', 'aidy'
> >    Field.assert 'username', 'aidy'
> >    Field.set 'password', 'password123'
> >    A_Button.press 'login'
> >    Explorer.close
> >
> >  end
> >
> > end
> >
> > TestClass.new.test_1
> > <snip>
> >
> > Not so sure about logging, but will probably write to XML
> >
> > Any opinions?
> >
> > aidy
> > _______________________________________________
> > Wtr-general mailing list
> > Wtr-general@rubyforge.org
> > http://rubyforge.org/mailman/listinfo/wtr-general
> >
> _______________________________________________
> Wtr-general mailing list
> Wtr-general@rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to