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

Closing browser window problem

9 Answers 315 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
macon
Top achievements
Rank 1
macon asked on 29 Apr 2010, 09:07 AM
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)

9 Answers, 1 is accepted

Sort by
0
macon
Top achievements
Rank 1
answered on 29 Apr 2010, 01:25 PM
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
0
Cody
Telerik team
answered on 29 Apr 2010, 06:46 PM
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.
0
SD
Top achievements
Rank 1
answered on 27 May 2010, 02:50 AM
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. 
0
Cody
Telerik team
answered on 27 May 2010, 07:27 PM
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.
0
Sudarshan
Top achievements
Rank 2
answered on 16 Jul 2013, 05:30 AM
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
0
Cody
Telerik team
answered on 17 Jul 2013, 06:38 PM
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
0
Sudarshan
Top achievements
Rank 2
answered on 18 Jul 2013, 03:48 AM
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

 







0
Sudarshan
Top achievements
Rank 2
answered on 18 Jul 2013, 06:28 AM
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
0
Cody
Telerik team
answered on 18 Jul 2013, 08:34 PM
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
Tags
General Discussions
Asked by
macon
Top achievements
Rank 1
Answers by
macon
Top achievements
Rank 1
Cody
Telerik team
SD
Top achievements
Rank 1
Sudarshan
Top achievements
Rank 2
Share this question
or