Forum Discussion
The right and correct condition for your test to work properly is to use a single browser, single instance, and a single tab. When you perform the check it always goes to first browser, first instance, and first tab.
When Edge is closed, it maintains a session in memory, process keeps running. Try to force the above condition by checking for all browsers and terminating process https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/window-and-process/terminate-method-process-object.html
function CloseProcess()
{
var arr = ["iexplore", "firefox", "chrome", "MicrosoftEdge"];
arr.forEach(function(element){
Close_Process_Instances(element);
} );
function Close_Process_Instances(ProcessName)
{
var p = Sys.FindChild("ProcessName", ProcessName);
while (p.Exists)
{
p.Terminate();
p = Sys.FindChild("ProcessName", ProcessName);
}
}
}
Also, not sure it applies, but try to clear TestComplete browser.page cache https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/common-for-all/refreshmappinginfo-method.html?sbsearch=RefreshMappingInfo%20Method
Hi Hassan, thank you for your reply!
Sadly I already have some closing logic for the edge process and i tried so many variations of it.
I also tried what you suggested to do a theBrowser.RefreshMappingInfo and page.RefreshMappingInfo and it doesnt work either.
What is weird is that the actual page seems found, but the URL not loaded at all. See:
I will continue to investigate but at this stage im pretty much getting clueless...
FYI, i did try to follow the edge setup as stated there:
Preparing Edge for Web Testing | TestComplete Documentation
- Hassan_Ballan8 days agoFrequent Contributor
Hello SlickRick you are testing a desktop application but do you have the web module license to interact with webpages?
When I manually navigate to the URL, in TestComplete when I inspect "Object Browser", I do see the page with the URL value. In your screen shot your page value is blank and you are viewing the BrowserWindow and not the page.
- SlickRick8 days agoFrequent Contributor
Yes I do have the licenses with web testing.
I have 2 screenshots, one showing the page("") to show that the detected page is the correct one but with an empty URL. And the browser window to again show that it detected the right page.
As mentioned there is a twisted scenario where this occurs. It is really odd.
If i open a new tab and navigate to the URL manually i get the same result as you. Everything is fine:
But when the page is opened via my app the url is empty, but the page content is fine.
If i try to open the page using a powershell script:
Start-Process "https://www.sestech.com/Home/Contact"
The URL is empty.- Hassan_Ballan8 days agoFrequent Contributor
Using console or power-shell command, I do get Edge with the correct URL. Ask your developers on how the application is opening such URL, it may be relevant or to at least try it out manually using the same command.
Use windows task manager to make sure Edge is not running, process close is different from terminate (with Edge you need to terminate processes).
I made the following test loop and it works successfully every-time. If it fails for you I hope you can find something new to follow upon.
Notice the page wait, something you should use rather than the 5 seconds wait.
function Test1() { // Loop 10 times or as many as you need var Var1, TimeoutValue; Var1 = 1; for(Var1 = 1; Var1 <= 10; Var1 = Var1 + 1) { CloseProcess(); // Terminate browser processes //Run browser, navigate to URL Browsers.Item(btEdge).Run(); Browsers.Item(btEdge).Navigate("https://www.sestech.com/Home/Contact"); // Read deafult timeout, change it to one minute, wait for page, and restore timeout value TimeoutValue = Options.Run.Timeout; Options.Run.Timeout = 60000; Aliases.browser.pageX.Wait(); Options.Run.Timeout = TimeoutValue; // Validate page URL if(Aliases.browser.pageX.URL == "https://www.sestech.com/Home/Contact") Log.Message(Aliases.browser.pageX.URL, ""); else { Log.Error(Aliases.browser.pageX.URL, ""); Runner.Stop(); } Aliases.browser.pageX.Close(); // Close browser } }
What do you have in the NameMapping for the browser and the page? I have * for the page URL as in any page, but works the same if you have the correct URL.
Related Content
- 2 years ago
- 4 years ago
- 7 years ago
Recent Discussions
- 21 hours ago