In certain scenarios you may wish to close your current browser and create a new instance/cache within a single transaction. The following steps will help you accomplish this scenario.
1. Begin your transaction using the beginTransaction method
2. Define an instance of a browser with openBrowser
3. Perform your step(s)
4. Use quit to terminate your browser instance
5. Define a new browser with an empty cache using openBrowser a second time
4. Perform your second set of step(s)
5. End the transaction with endTransaction
Example:
test.beginTransaction();
// Load initial browser
var browser = test.openBrowser();
test.beginStep("Load a page and close the browser");
browser.get("https://www.vercara.com");
test.waitForNetworkTrafficToStop(500, 15000);
browser.quit();
test.endStep();
// Reload the browser
var browser = test.openBrowser();
test.beginStep("Load the page with a new cache");
browser.get("https://www.vercara.com");
test.waitForNetworkTrafficToStop(500, 15000);
test.endStep();
test.endTransaction();
Additional Information:
While this will launch a new browser instance with a clear cache, a proxy connection is only established once per transaction. Thus, the initial load will include the connect time, whereas subsequent requests will not.