Rohan, Thanks, yes I tried re-attaching and its working fine now :-) Ethan, Thanks for the info, I am yet to try out the Vapir-Firefox. Will check and confirm.
Thanks, Pavithra On Nov 8, 10:06 pm, Rohan Premvallabh Ojha <[email protected]> wrote: > Hi, > > You will have to re-atach the first window back to the instance after you > have closed the second widnow. > > Something like : > > @obj.button(:x,y).click > > sleep 2 > > @obj=Watir::Browser.attach(:title,Second window) > > @obj.close > > sleep 2 > > @obj=Watir::Browser.attach(:title,First window) > > sleep 2 > > @obj.link(:x,y).click > > Not sure it will solve your problem but I guess it will cos re-attaching > always worked for me.:) > > Thanks > Rohan Ojha > > ________________________________________ > From: [email protected] [[email protected]] On > Behalf Of Pavithra [[email protected]] > Sent: 08 November 2010 16:11 > To: Watir General > Cc: [email protected] > Subject: [wtr-general] Re: How to get back to the base browser window after > closing the second browser instance > > Karthik, > > I tried using but its throwing the same error. > One interesting thing here is it is able to identify the initial > browser however its failing to find the elements. > I tried $browser.close() (after closing the 2nd browser instance) it > worked, but not identifying the elements in the browser [when I try to > click some link instead of $browser.close()]. However the same > elements are getting identified before closing the second browser > instance, so getting confused. > > Thanks, > Pavithra > > Hi, > > if you use global $ instead class instance @@ it should work. > > Cheers. > > On Nov 8, 12:07 pm, Pavithra <[email protected]> wrote: > > > > > Hi, > > I am testing the website in Firefox. > > > On a click of the link it opens the new browser window and I closed > > that using close method. > > But after closing its unable to identify the objects using browser > > variable. Below was my browser variable which worked to open the > > website and perform various actions, however the same variable is not > > working after closing the second browser window. > > > For 1st browser > > @@browser = Watir::Browser.new > > > For 2nd browser: > > @@browser1 = Watir::Browser > > > Testcase flow: > > @@browser.link(:text,"XYZ").click [Worked] > > @@abc=@@browser1.attach(:url,"http://xyz") [Worked] > > @@abc.close() > > [Worked] > > @@browser.link(:text,"ABCD").click [Not working] > > > Note: After closing the second browser window, its showing my initial > > browser, however i am not sure whether the script has come back to > > initial browser. > > Kindly help me out to get back to the initial browser window. > > > Thanks, > > Pavithra > > -- > Before posting, please readhttp://watir.com/support. In short: search before > you ask, be nice. > > [email protected]http://groups.google.com/group/watir-general > [email protected] -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. [email protected] http://groups.google.com/group/watir-general [email protected]
