Sorry, missed that part. I haven't tried it the way that the example describes. 
The following works for me:

require 'watir/browser'  
Watir::Browser.default = 'firefox'
b = Watir::Browser.new 

I basically have a test runner that takes a command line option for the browser 
type. When it starts it sets the browser type as described above and doesn't 
touch it after that. If you do something like this in the script:

require 'watir/browser'  
Watir::Browser.default = ARGV[0]
b = Watir::Browser.new

and then call the script this way from DOS you won't have to keep changing back 
and forth:

script.rb firefox

I've stayed away from calling Watir::Browser.default more than once (i.e., 
changing the value in irb or in a script once it has been initially set).



--- On Thu, 12/11/08, Margam <nk.mar...@gmail.com> wrote:

> From: Margam <nk.mar...@gmail.com>
> Subject: [wtr-general] Re: set watir_browser=ie is not working
> To: "Watir General" <watir-general@googlegroups.com>
> Date: Thursday, December 11, 2008, 4:14 PM
> Hi John,
> So I tried using "require 'watir/browser'
> " in my script and "set
> watir_browser=ie" from command prompt and everything
> is OK. IE is
> opened and the scripts runs fine.
> But when I type "set watir_browser=firefox" from
> command prompt and
> run the script, IE is still used. Firefox is not launched.
> Am I doing something wrong.
> 
> Also for the time being I am doing to just change the
> default browser
> from the script itself (which works fine).
> 
> Thank you
> Margam
> 
> 
> On Dec 11, 9:46 am, John Fitisoff
> <jfitis...@yahoo.com> wrote:
> > I think the problem is that you are requiring watir
> rather than watir/browser. Something like this should work:
> >
> > require 'rubygems'
> > require 'watir/browser'
> > set watir_browser=ie
> > browser = Watir::Browser.new
> > browser.goto("http://www.hotmail.com";)
> >
> > --- On Wed, 12/10/08, Margam
> <nk.mar...@gmail.com> wrote:
> >
> > > From: Margam <nk.mar...@gmail.com>
> > > Subject: [wtr-general] set watir_browser=ie is
> not working
> > > To: "Watir General"
> <watir-general@googlegroups.com>
> > > Date: Wednesday, December 10, 2008, 4:45 PM
> > > HI All,
> > > I am trying to write one script that will work on
> both IE
> > > and FF. As
> > > per the link:
> > >http://wiki.openqa.org/display/WTR/Browser.new
> >
> > > I am trying to use the "set
> watir_browser=ie"
> > > command and
> > > Watir::Browser.new
> >
> > > The code is :
> > > --------------
> > > require 'rubygems'
> > > require 'watir'
> >
> > > set watir_browser=ie
> > > browser = Watir::Browser.new
> > > browser.goto("http://www.hotmail.com";)
> > > ----------
> >
> > > But keep getting the following error:
> > > ---------
> > >  undefined method `set' for main:Object
> (NoMethodError)
> > > -----------------
> > > What am I doing wrong? Should I require any other
> library?
> >
> > > Thank you.
> > > Margam
> 

      

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to