From: Anukul Singhal Date: 2008-04-30T19:13:10+09:00 Subject: Re: Watir : Working in same session of IE Pe単a, Botp wrote: > From: list-bounce@example.com > # Actually am stuck in a problem. > # I am performing the following set of commands: > # require 'watir' > # ie = Watir::IE.new > # ie.goto("http://www.google.com") > # When I execute, it successfully opens a new browser with the correct > # google url. > # Now, in this code, I simply want to add: > # ie.text_field(:name, "q").set 'roger federer' > # If I append the above line to the above code, it will open a > # new session of IE > > that's weird. i just tried your code, and it does *not open another > (new) session (in that case, i only have 1 ie session open, not 2). > > kind regards -botp Hi botp, Are you trying this out in Scite or is their something else that you are using?I believe when you execute (F5) the first two lines of code, it will open IE with google url. Now, with the google url already open, I want to update the code in such a way that I can enter the text in the search field without opening a new session of the browser. So, if I just add the 3rd line of my code and execute, it would definitely open a new instance of IE (since it will execute ie = Watir::IE.new again). I want to avoid that, hoping that there must be a logic between the first 2 lines and the 3rd line which avoids opening a new browser. Another idea would be to check if there is an existing instance of IE already present and then we can just do ie.goto(url). Can you help with the logic? Thanks, Anukul -- Posted via http://www.ruby-forum.com/.