Re: [wtr-general] Opening new browser window from existing one
Hi Vishavdeep, I got my problem solved.yes my app does not have the code to open in new window. Actually i totaly misunderstood the attach method. Now got the concept and problem is solved Thanks a lot for notifying me. On Wed, Dec 1, 2010 at 1:20 PM, Sharma Vishav sharma.vis...@gmail.comwrote: 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/newNew 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.comwatir-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.comwatir-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
Re: [wtr-general] Opening new browser window from existing one
On Tue, Nov 30, 2010 at 7:24 AM, Amit Kulkarni amitkkulkarni...@gmail.com wrote: titleUsers: new/title titleUsers: index/title on the top Browser.attach(:title, '/Users: new/') I am now completely confused what is the title of the page that you want to attach to. One of these could work: Browser.attach(:title = Users: new/) Browser.attach(:title = Users: index/) Browser.attach(:title = /Users: new/) Browser.attach(:title = /Users: index/) Browser.attach(:title = /Users/) More information: http://wiki.openqa.org/display/WTR/New+Browser+Windows Željko -- 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
Re: [wtr-general] Opening new browser window from existing one
Hi, This is my code: require 'rubygems' require 'firewatir' Watir::Browser.default = 'firefox' Browser = Watir::Browser.new Browser.goto(http://localhost:3000/users;) This goes to the application B = Browser.title.each { |d| puts d.to_s } here i am checking if that page(above) contains any title.The ans is true and i am getting Users: a = Browser.link(:title, Users:).exist? puts a sleep 5 Browser.attach(:title, '/Users:/') On this i get an error i.e. `attach': Unable to locate window, using title and /Users:/ (Watir::Exception::NoMatchingWindowFoundException) Now if i try Browser.attach(:title, Users:) --- No error is displayed and link is not clicked. -- Now the title on clicking the link is Users: which is same which i have mentioned I hope now the confusion is clear :) Please let me know if you require any more info. 2010/11/30 Željko Filipin zeljko.fili...@wa-research.ch On Tue, Nov 30, 2010 at 7:24 AM, Amit Kulkarni amitkkulkarni...@gmail.com wrote: titleUsers: new/title titleUsers: index/title on the top Browser.attach(:title, '/Users: new/') I am now completely confused what is the title of the page that you want to attach to. One of these could work: Browser.attach(:title = Users: new/) Browser.attach(:title = Users: index/) Browser.attach(:title = /Users: new/) Browser.attach(:title = /Users: index/) Browser.attach(:title = /Users/) More information: http://wiki.openqa.org/display/WTR/New+Browser+Windows Željko -- 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.comwatir-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
Re: [wtr-general] Opening new browser window from existing one
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.comwrote: 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/newNew 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.comwatir-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
[wtr-general] Opening new browser window from existing one
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/newNew 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
Re: [wtr-general] Opening new browser window from existing one
On Mon, Nov 29, 2010 at 5:13 PM, Amit Kulkarni amitkkulkarni...@gmail.com wrote: Browser.attach(:title, '/test123/') a title=test123 href=/users/newNew user/a If a link has title test123, it does not mean that the page that it leads to will have the same title. Inspect the page code and take a look what is inside title tag. Željko -- watir.com - community manager watirpodcast.com - host testingpodcast.com - audio podcasts on software testing. all of them -- 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
Re: [wtr-general] Opening new browser window from existing one
Hi, Thanks for the reply. I checked page code and this is what is inside the title tag a href=/users/new view-source:http://localhost:3000/users/new title=test123New user/a This is also what i have written in the code. On Mon, Nov 29, 2010 at 9:49 PM, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Mon, Nov 29, 2010 at 5:13 PM, Amit Kulkarni amitkkulkarni...@gmail.com wrote: Browser.attach(:title, '/test123/') a title=test123 href=/users/newNew user/a If a link has title test123, it does not mean that the page that it leads to will have the same title. Inspect the page code and take a look what is inside title tag. Željko -- watir.com - community manager watirpodcast.com - host testingpodcast.com - audio podcasts on software testing. all of them -- 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.comwatir-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
Re: [wtr-general] Opening new browser window from existing one
This line does not care what is on the current page: Browser.attach(:title, '/test123/') it cares what is on the page that will be opened. So, open the page that will open after clicking the link manually, and take a look what it inside it's title tag (in header). Željko -- 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
Re: [wtr-general] Opening new browser window from existing one
Hi, The page which is going to open has the following in the title tag. titleUsers: new/title I changed the title tag which is currently present on the page from where i am going to click. So following is displayed under title tag: titleUsers: index/title on the top AND a href=/users/new view-source:http://localhost:3000/users/new title=Users: newNew user/a --- This is the link which i am going to click.. So in the code i have changed which looks like as follows : *Browser.attach(:title, '/Users: new/')* Even changing the code i am getting the same error. On Mon, Nov 29, 2010 at 10:19 PM, Željko Filipin zeljko.fili...@wa-research.ch wrote: This line does not care what is on the current page: Browser.attach(:title, '/test123/') it cares what is on the page that will be opened. So, open the page that will open after clicking the link manually, and take a look what it inside it's title tag (in header). Željko -- 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.comwatir-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
Re: [wtr-general] Opening new browser window from existing one
Hi, Currently i am using FireWatir on Linux.So i am just thinking is there any problem in the code running on Linux and running it on windows. On Tue, Nov 30, 2010 at 11:54 AM, Amit Kulkarni amitkkulkarni...@gmail.comwrote: Hi, The page which is going to open has the following in the title tag. titleUsers: new/title I changed the title tag which is currently present on the page from where i am going to click. So following is displayed under title tag: titleUsers: index/title on the top AND a href=/users/new title=Users: newNew user/a --- This is the link which i am going to click.. So in the code i have changed which looks like as follows : *Browser.attach(:title, '/Users: new/')* Even changing the code i am getting the same error. On Mon, Nov 29, 2010 at 10:19 PM, Željko Filipin zeljko.fili...@wa-research.ch wrote: This line does not care what is on the current page: Browser.attach(:title, '/test123/') it cares what is on the page that will be opened. So, open the page that will open after clicking the link manually, and take a look what it inside it's title tag (in header). Željko -- 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.comwatir-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