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.
Use the close command and then start a new instance
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.
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.
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); driver.get("http://www.google.com/");