Failing the test when closing the browser window

Jun 14, 2012 at 9:04 PM
Hello,
 

        public static void SignOut(TestContext testInst)
        {
            //SignOut
            Header pgHeader = CUITe_BrowserWindow.GetBrowserWindow();
            pgHeader.lnkSignOut.Click();
            //Validate SignOut
            Library.ScreenCapture(pgHeader, testInst);
            Assert.IsTrue(pgHeader.divHeaderRole.InnerText.Contains("Sign in"));
            pgHeader.Close();
            return;
        }

Calling the above method from Library.cs

  Library.SignOut(this.TestContext);  

My browser window is closing and throwing following error  
and my test is failing

Test method Portal.Test.Int.SignInTests.SignInasAgreementAdminTest threw exception: 
System.UriFormatException: Invalid URI: The URI is empty.


I observed this when i call the method from Library file. Where as it is working normally.
What is happening at the end of the return call when window is closing? 
Really Appreciate your help



 



Coordinator
Jun 15, 2012 at 2:30 AM

Hi Sailaja,

Can you provide the full stack trace of the exception please?

Please also make a note of the lines of code that are indicated in the stack trace.

Thank you.

Aug 6, 2012 at 3:18 PM

Hi,

I had similar issue. The root cause was that the site's title changed after loging out. Solution is simple:

Site1 homepage = CUITe_BrowserWindow.GetBrowserWindow<Site1>();
Site1AfterLogout trash = CUITe_BrowserWindow.GetBrowserWindow<Site1AfterLogout>();
//******************
//
Test script here *
//******************
homepage.buttonLogout.Click(); trash.Close();

Best regards,

Jakub