I can create a browser loop in a Keyword test. Some Webinars suggest running tests in private or incognito mode as you would more accurately simulate the first use and discard any cache issues ...
Browser Loop - incognito mode
Lee_M
2 years agoCommunity Hero
update:
my tests all now start a 2-step open process
1, testedApp calling batch file for flush cache
file code:
ipconfig /flushdns
2, function script with incognito mode
- make sure testcomplete extension is enabled for incognito mode !!
navigate browser as normal
ALL tests now run incognito and a free of any cache issues
- this can be hooked up to any start event or login process as the tests require
Here is my code for step 2 in case it helps anyone (Javascript)
---------------------------------
function open_secret_browser(browserName = "chrome"){
switch (browserName) {
case "edge":
browserName = "edge";
browserType = btEdge;
break;
case "firefox":
browserName = "firefox";
browserType = btFirefox;
break;
case "chrome":
default:
browserName = "chrome";
browserType = btChrome;
}
browserName = aqString.ToLower(browserName);
TestedApps.clear_cache.Run();
if (Sys.WaitBrowser(browserName).Exists){
var browser = Sys.Browser(browserName);
Log.Enabled = false // To disable the warning that might occur during closing of the browser
browser.Close();
Log.Enabled = true // enabling the logs back
}
Delay(500)
switch (browserName) {
case "edge":
Browsers.Item(btEdge).RunOptions = "-inprivate";
break;
case "firefox":
Browsers.Item(btFirefox).RunOptions = "-private-window";
break;
case "chrome":
default:
Browsers.Item(btChrome).RunOptions = "-incognito";
}
Browsers.Item(browserType).Run();
Sys.Browser(browserName).BrowserWindow(0).Maximize()
}
Related Content
- 5 years ago
- 3 years ago
- 7 years ago