Unexpected of closing browser issue

2 posts, 0 answers
  1. Phuong
    Phuong avatar
    6 posts
    Member since:
    Dec 2010

    Posted 29 Sep 2011 Link to this post

    We have to create a test with the following steps:

    - Open a Form View page (contains  two buttons ‘ctlView’ and ‘ctlEdit’)
    - Click ‘View’ button
    - an HTML pop-up window will be displayed
    - close pop-up above
    - Continue find and click on the other ‘Edit’ button on the Form View page.

    This is my code:

    ActiveBrowser.NavigateTo(“~/FormView.aspx”)
    Dim btnView As HtmlInputButton = ActiveBrowser.Find.ById("ctlView")

    Manager.SetNewBrowserTracking(True)
    btnView.Click(False)
    Manager.WaitForNewBrowserConnect("ViewStatus.aspx”, True, 3000)
    ActiveBrowser.WaitUntilReady()
    Manager.SetNewBrowserTracking(False)

    Assert.IsTrue(ActiveBrowser.Url.Contains("ViewStatus.aspx"))

    ActiveBrowser.Close()

    Dim btnEdit As HtmlInputButton = ActiveBrowser.Find.ById("ctlEdit")

    btnEdit.Click(False)


    My issue is that after executing the close pop-up statement  ActiveBrowser.Close(), two browsers (main page and HTML pop-up) are closed, and the test fail at step of  finding the ‘Edit’ button (Dim btnEdit As HtmlInputButton = ActiveBrowser.Find.ById("ctlEdit")).

    Anyone please help me to fix this problem?

    Thanks in advance

  2. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 30 Sep 2011 Link to this post

    Hi Phuong,

    Your code looks good. It's tough to say what's going wrong without testing your app directly. Is it possible the popup is losing focus, causing the windows to close out of order?

    Here is sample code that successfully executes against a public site with an HTML popup:

    Manager.LaunchNewBrowser()
     
    Manager.SetNewBrowserTracking(True)
     
    Find.ByTagIndex(Of HtmlAnchor)("a", 58).Click()
     
    Manager.WaitForNewBrowserConnect("http://www.htmlcodetutorial.com/linking/popup_test_a.html", True, 3000)
    Manager.SetNewBrowserTracking(False)
     
    Assert.IsTrue(Manager.Browsers.Count = 2)
    Assert.IsTrue(ActiveBrowser.Url.Contains("http://www.htmlcodetutorial.com/linking/popup_test_a.html"))
     
    ActiveBrowser.Close()
     
    Assert.IsTrue(Manager.Browsers.Count = 1)
    Assert.IsTrue(ActiveBrowser.Url.Contains("http://www.htmlcodetutorial.com/linking/linking_famsupp_70.html"))

    If your app is publicly accessible, I'd like to see the issue first hand. You can submit a support ticket with the pertinent reproduction instructions and/or a copy of the test files (within a .zip file). Unlike this thread, a support ticket is confidential.

    Out of curiosity, have you tried recording this popup scenario through the Recording UI? Please try that as well and see if the issue persists.

    Best wishes,
    Anthony
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top