Closing browser window problem

10 posts, 0 answers
  1. macon
    macon avatar
    12 posts
    Member since:
    Apr 2010

    Posted 29 Apr 2010 Link to this post

    I've got a page that opens up a HTML popup window (not modal) containing a cancel button that closes it. If I set:

    Manager.SetNewBrowserTracking(true)

    before the popup is called then, as documented, I get a new Browser in the Browsers collection and the Manager.ActiveBrowser is set to the popup. However, when I call the cancel button to close the window (remembering to pass true to the HtmlInputButton.Click(true) so that it knows I'm closing the window) the Browsers collection remains the same (2) and the ActiveBrowser is still set to the closed popup. Subsequently the next command, in this case ActiveBrowser.RefreshDomTree() causes failure below.

    The documentation states that when a popup window is closed the Browsers collection will be reduced and the ActiveBrowser will be set to the last browser, but this doesn't appear to happen. Is there something I'm missing here?

    Cheers,
    Matt


    ArtOfTest.WebAii.Exceptions.ExecuteCommandException: ExecuteCommand failed!
    BrowserCommand (Type:'Information',Info:'DocumentMarkup',Action:'NotSet',Target:'null',Data:'',ClientId:'Client_ad8cae06-40c6-448e-8654-f431fd539687',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'-1',InError:'False',Response:'')
    InnerException: System.InvalidOperationException: This client 'Client_ad8cae06-40c6-448e-8654-f431fd539687' is not connected to remote to be able to process command.
       at ArtOfTest.WebAii.Core.Browser.ExecuteCommandInternal(BrowserCommand request)
  2. macon
    macon avatar
    12 posts
    Member since:
    Apr 2010

    Posted 29 Apr 2010 Link to this post

    I think I figured it out. I was missing the "Manager.WaitForNewBrowserConnect" call.

    Additionally you need to call ActiveBrowser.Close() when the browser is closed otherwise the Browsers collection and ActiveBrowser remain set to an unconnected browser instance. It's a bit of a shame that WebAii doesn't recognise the close of the browser and clear up or event provide an event?

    Cheers,
    Matt
  3. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 29 Apr 2010 Link to this post

    Hello macon,

    I'm very glad to hear you were able to resolve the problem yourself. Also thanks for pointing out that the ActiveBrowser.Close() call seems redundant. We'll see if we can improve that in a future release.

    Kind regards,
    Cody
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  4. SD
    SD avatar
    62 posts
    Member since:
    Apr 2010

    Posted 26 May 2010 Link to this post

    Handling pop-ups has become an important aspect of testing as many web apps
    nowadays 'resides' in a pop-up to prevent users, for example, from using browser controls etc...

    SD. 
  5. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 27 May 2010 Link to this post

    Hi SD,

    Yes you are correct. We very much appreciate your feedback and will work on making this scenario easier to worth with. We are always looking for ways of making our product easier to use while performing the testing requirements needed in todays web 2.0 world.

    All the best,
    Cody
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  6. Sudarshan
    Sudarshan avatar
    22 posts
    Member since:
    Feb 2013

    Posted 16 Jul 2013 Link to this post

    Hi Telerik,

    I reproduced the same issue raised by macon.

    While handling popups, when i call the ok or cancel button to close the popup it closes both the popup and the application.

    I'm using the Telerik Testing Framework 2012.2.1527.

    The Code i used for handling the popup:

    Manager.SetNewBrowserTracking(true);

    element.Click(); //This opens the Popup

    Manager.SetNewBrowserTracking(false);

    manager.WaitForNewBrowserConnect("xxxxx" , true , 5000);

    rest of the code to handle elements in Popup that works fine


    OkButton.Click(true);

    //Rest of the code

    It handles the elements present in the popup, however on clicking the ok or cancel button, it closes the browser.

    I even tried these lines of code, but the result is the same.

    OkButton.MouseClick();
    Okbutton.MouseClick(MouseClickType.LeftClick);
    Okbutton.MouseClick(MouseClickType.LeftDoubleClick);
    OkButton.Click(false);
    Okbutton.Click();

    I even tried without using the SetNewBrowserTracking, but still the same result.


    This is the error i'm getting:

    ExecuteCommand failed!
    BrowserCommand (Type:'Information',Info:'DocumentMarkup',Action:'NotSet',Target:'null',Data:'',ClientId:'Client_6ea0178a-0a52-4b58-add8-fa5748c9c9e2',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'-1',InError:'False',Response:'')
    InnerException: System.InvalidOperationException: This client 'Client_6ea0178a-0a52-4b58-add8-fa5748c9c9e2' is not connected to remote to be able to process command.
       at ArtOfTest.WebAii.Core.Browser.ExecuteCommandInternal(BrowserCommand request)


    It closes the Browser after handling the Popup. Is there anything i'm missing?


    Thanks in Advance
    Sudarshan
  7. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 17 Jul 2013 Link to this post

    Hi,

    The error: 
    This client 'Client_6ea0178a-0a52-4b58-add8-fa5748c9c9e2' is not connected to remote to be able to process command.

    This is expected as a result of the main browser window closing. The problem to be solved is why is the main browser closing like that. This I cannot explain. I'm also unable to reproduce the symptom using this sample web page:
    http://www.w3schools.com/js/tryit.asp?filename=tryjs_openwindow

    We need to be able reproduce the problem on our local development environment before we can find the root cause and fix it. Can you send me a complete test I can execute on my machine that demonstrates this problem? Once I can reproduce the problem we can investigate what's causing it.

    Regards,
    Cody
    Telerik
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  8. Sudarshan
    Sudarshan avatar
    22 posts
    Member since:
    Feb 2013

    Posted 17 Jul 2013 Link to this post

    Hi,

    Thanks for the Response.

    I'm not allowed to share the application but i'm attaching the scenario.

    According to the documentation:
    http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/write-tests-in-code/advanced-topics/handling-html-popups-and-dialogs/built-in-dialog-handlers/handling-html-popups.aspx

    We tell the framework that click causes the popup to close by passing the parameter true to the click function and the Active Browser will be set to the browser window that was open prior to the popup opening.

    In the picture attached, the popup will be closed by clicking the save button and the active browser should be set to the window that was open prior to the popup opening.

    But what is happening is it closes both the windows(Popup and the window that was opened prior to popup) on clicking the save button.

    This was working fine with telerik 2011 testing framework.

    I upgraded from 2011 to 2012 and finding this closing browser window problem.

    Thanks
    Sudarshan

     







  9. Sudarshan
    Sudarshan avatar
    22 posts
    Member since:
    Feb 2013

    Posted 18 Jul 2013 Link to this post

    Hi Cody,

    Got the solution for this.

    In the settings part, had set the KillBrowserProcessOnClose to true, so it was closing both the popup and the mainwindow after the popup was handled.

    However this was working fine with telerik Testing framework 2011.

    For Telerik 2012 Framework had to set 
    KillBrowserProcessOnClose to false and call ActiveBrowser.Close() at the end of the script.

    Thanks
    Sudarshan
  10. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 18 Jul 2013 Link to this post

    Hello Sudarshan,

    Fantastic you were able to find a solution on your own.

    I tried reproducing the behavior in a sample test with KillBrowserProcessOnClose = true. It behaved the just fine for me. This makes me think it's somehow application or test code structure specific. But since you're now unblocked I'm not going to worry about it.

    Regards,
    Cody
    Telerik
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top