0

I am trying to close and then re-open the FF browser with different URL.

  • 1
    What language do you use? What did you tried and how it failed? Show us the code. – Peter M. - stands for Monica Nov 10 '14 at 16:57
  • Do you really need to close browser? If you do, get() another url. Do you need more details how to do that? – Peter M. - stands for Monica Nov 10 '14 at 19:40
3

You can open 2 browsers by initializing 2 firefox instance and then get() method will open URL in each browser accordingly.

Do you want to use 1 firefox instance i.e. open it, close it and open it again ?

| improve this answer | |
2

Try this:

     public static void main(String[] args) throws IOException 
        {

            // Launch The Browser
            WebDriver driver = new FirefoxDriver();
            driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
            // Enter Url

            driver.get(baseurl);

            driver.close();
            driver.quit();

            WebDriver driver2 = new FirefoxDriver();
            driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
            driver.get(enter your second url);
        }

I hope this code works for you.

| improve this answer | |
0

As far as I know, it's not possible to close a tab or window and open another with Selenium's basic setup. IWebDriver might be what you're looking for as it enables you to control the browser.

However, I'm not sure what you'd gain from closing the window and then going to a different URL anyway check this link - maybe you could be more specific as to what you're wanting it to achieve?

Let me know if this helps.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.