Hi Amit,

does your application code has code to open a new window when you click on
the link. e.g. use target attribute of href tag.

When you click link manually do you get a new window opened ?  why do you
want to open a new window from your watir script ?

cheers
Vishavdeep

On Tue, Nov 30, 2010 at 5:13 AM, Amit Kulkarni
<amitkkulkarni...@gmail.com>wrote:

> Hello all,
> Can we open a new browser window from the existing one using Firewatir for
> Linux and for Watir for windows:
> Following are my gem versions:
>
> firewatir (1.6.7, 1.6.5)
>
> Following is my code:
> require 'rubygems'
> require 'firewatir'
> Watir::Browser.default = 'firefox'
> Browser = Watir::Browser.new
> Browser.goto("http://localhost:3000/users";)
> sleep 5
> *Browser.attach(:title, '/test123/')*
> #Browser.link(:href, "/users/new").click
> Browser.text_field(:name, "user[name]").set("amit")
> Browser.text_field(:name, "user[description]").set("Qa Engineer")
> Browser.select_list(:name, "user[role]").select("Hr")
> Browser.radio(:id, "user_category_hr").set
> Browser.button(:value, "Create").click
> Browser.link(:href, "/users").click
>
> The line which is bold is what i am doing for opening the link in new
> window.Actually this is a link which you can see in the next line which is
> commented.
> Now if i click on the link then it opens in the same window.What i want is
> when i click on the link it should open in new window.
> I have added the *title property* for the link as well
>
> In the Firefox->Edit->Preferences->tab i have unchecked the tab "Open new
> windows in new tab instead"
>
> But when i run the script it error is displayed as
> "/usr/lib/ruby/gems/1.8/gems/firewatir-1.6.7/lib/firewatir/firefox.rb:272:in
> `attach': Unable to locate window, using title and
> /test123/(Watir::Exception::NoMatchingWindowFoundException)
>     from user_create.rb:9"
>
> When i inspect the link following code is displayed "<a title="test123"
> href="/users/new">New user</a>"
>
>
>  --
> Before posting, please read http://watir.com/support. In short: search
> before you ask, be nice.
>
> watir-general@googlegroups.com
> http://groups.google.com/group/watir-general
> watir-general+unsubscr...@googlegroups.com<watir-general%2bunsubscr...@googlegroups.com>
>

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

Reply via email to