user669789
user669789

Reputation: 625

new window creation in watir

I am new to watir. I am trying to create new ie window with

browser = Watir::Browser.new

but it gives error message like

`user_is_bewildered': Error in the default values: :browser's value must be one of 'ie', 'firefox', or 'safari', and '' doesn't look right. (StandardError)

I donno how to set default browser. Can some one help me? There is a another thread here. But I am not able to understand what i need to do in ffi.

Thanks

Upvotes: 1

Views: 749

Answers (4)

user669789
user669789

Reputation: 625

The issue is resolved. Thanx for the the inputs. The issue was with wrong nokorigi gem installation, initially i installed x86-mswin32-60, i uninstalled it and tried with x86-mingw32, it solved.

Upvotes: 0

anonygoose
anonygoose

Reputation: 739

If this is the original Watir gem, then the following is how I used to launch it:

require 'rubygems'
require 'watir'

Watir::Browser.default = "firefox"
browser = Watir::Browser.new

# Whatever you want to do in watir

IamChuckB's answer may be a more efficient way of doing this, but having not used it, I'm not sure.

Upvotes: 2

Dave McNulla
Dave McNulla

Reputation: 2016

To install devkit,

  1. create a folder in the ruby directory called devkit
  2. get the devkit from here
  3. unpack it into the devkit directory created in step 1
  4. add c:\ruby193\devkit\bin;c:\ruby193\devkit\wming\bin to your path, of course adjusting for your ruby install directory

now open a command prompt to install the gem again

c:\> gem install watir

Upvotes: 1

chucksmash
chucksmash

Reputation: 6017

You need to tell it which browser to open. Try this:

browser = Watir::Browser.new :ff

I haven't played around with watir since my last job so I had to look this up. As I last recall, WATIR was not entirely integrated with FireWATIR (the Firefox based variant). It's good to see that the two have apparently been reconciled in the meantime.

Taken from Watir in Five Minutes on Zeljko Filipin's github, BTW.

Upvotes: 2

Related Questions