This is a migrated thread and some comments may be shown as answers.

Unexpected of closing browser issue

1 Answer 47 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Phuong
Top achievements
Rank 1
Phuong asked on 29 Sep 2011, 04:36 PM

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

1 Answer, 1 is accepted

Sort by
0
Anthony
Telerik team
answered on 30 Sep 2011, 07:58 PM
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.
Tags
General Discussions
Asked by
Phuong
Top achievements
Rank 1
Answers by
Anthony
Telerik team
Share this question
or