Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to verify some functionality around present the user with the option to pick up where they left off when they return to the site after having abandoned their cart. How can I close the browser and start it again in the middle of the test case so I can verify that the modal appears? I'm using RemoteWebDriver.

share|improve this question
up vote 5 down vote accepted

Use the close command and then start a new instance

share|improve this answer

The easiest way is to not do it; I spoke to my devs, and the same effect will happen if I navigate away and then back. But I'm still curious about how I would restart the browser if I had to.

share|improve this answer

You can have two separate tests. One will put stuff in cart and close. Another test will start new browser, logs as same user, and checks if cart is in expected state. FOr extra credit you may start different kind of browser.

share|improve this answer
Isn't it bad form to have tests dependent upon other tests, marrying them to a specific order they must be run in? :( – Yamikuronue May 2 '14 at 0:20
Well yes it is bad - it was a solution for your problem. Solution is always compromise. Not sure why a solution was worth downvote. I am waiting if someone has better one. – Peter Masiar May 2 '14 at 0:26

this code work for me

    driver.manage().deleteAllCookies();         // Clear Cookies on the browser
    driver.close();                             // Close a single browser window

    ProfilesIni firProfiles = new ProfilesIni();        
    FirefoxProfile wbdrverprofile = firProfiles.getProfile("default");          
    driver = new FirefoxDriver(wbdrverprofile);                 
share|improve this answer
If the accepted answer does not solve the problem for you, you need to ask a new question. You can link to this question if it's appropriate. – Kate Paulk May 11 '15 at 11:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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