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

SetFocus was not working when more then one popup is active

3 Answers 36 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Venugopal
Top achievements
Rank 1
Venugopal asked on 23 Jan 2013, 12:20 PM
I have a scenario in which I have three browsers instances are active i.e i have main browser then i have clicked on a button to open a popup(lets name it as "popup1") and created a record in the popup then i clicked on a button to open another popup(lets name it as "popup2"), Now i have three browser instances one is main browser and two popups(popup1 and popup2). 

Now i have connected to popup2 then created a record and closed popup2 here my active window will be popup1, this is  the scenario i am trying to execute. While replaying on IE it is able to connect to popup2 and able to write in the text boxes of popup then record was created but while closing the popup2 it is closing the popup1. To rectify this problem i have customized the closing step like below:

Manger.Browsers[2].Close();

Now popup2 is closed and popup1 became active then i am able to perform some actions in popup1.
So this test case is working fine in IE But my problem is with chrome and FF. While replaying in FF or Chrome, popup2 connection step executed successfully but when it is trying to type some thing in popup2 text box then focus is going popup1, it is searching text box in popup1 so the test case was failing. So i have added a script step before the step which typing some text in to the text box. Code for the script step is:

Browser br= Manager.Browsers[2];
br.Window.SetFocus();

Can you please guide me this problem so that i can make this test case pass?

3 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 23 Jan 2013, 01:53 PM
Hello Venugopal,

I am sorry to hear you are running into this problem. Unfortunately without a local repro of this behavior it's hard to say why it is not working in Chrome and Firefox. One thing you can try however is to add the following line before the second "Connect to pop-up" step:
Manager.Wait.For<Manager>(manager => manager.Browsers.Count > 2, Manager, 10000);
This will ensure that the third popup is properly detected by our Popup Tracker.

If it still doesn't work, we'll need a local reproduction in order to continue troubleshooting. Please provide us with a copy of your test and access to your application. If it is not possible to grant us access to your application, please take a Fiddler trace using FiddlerCap and send it to us in a zip file. A Jing video demonstrating the issue may also help us to better understand what is happening. If you deem that information too sensitive for this forum, you can create a support ticket and attach it there. Thanks for providing the information we need to best assist you.

All the best,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Venugopal
Top achievements
Rank 1
answered on 25 Jan 2013, 09:21 AM
Thanks for the reply Plamen.

I have tried the code
Manager.Wait.For<Manager>(manager => manager.Browsers.Count > 2, Manager, 10000);

but it was giving exception for me, exception is:

"Exception thrown executing coded step: '[Case_Test_CodedStep9] : New Coded Step'.
InnerException:System.TimeoutException: Wait for condition has timed out"

So i removed this code and executed the test again this time as usual connection step executed successfully but when i am trying to access the elements of popup2 then it is giving exception as "Element was 'not found'"

Then i saw the images captured at the time of failure, "expected state image" is showing Second Popup window and "state captured at time of failure" is showing first popup window.

then i tried the below code:

Browser br= Manager.Browsers[2];
br.Window.SetFocus();

After this step i am trying to access the elements of popup2 then it is giving exception as :
ExecuteCommand failed!
BrowserCommand (Type:'Information',Info:'DocumentMarkup',Action:'NotSet',Target:'null',Data:'',ClientId:'b5732088-f743-413d-b152-4af3406523ce',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'-1',InError:'False',Response:'')
InnerException: System.TimeoutException: Timed out waiting for command to be handled
   at ArtOfTest.WebAii.Messaging.Process.BrowserHttpRemoted.ProcessBrowserRequest(BrowserCommand command, String requestId, Int32 timeout)
   at ArtOfTest.WebAii.Messaging.Process.BrowserHttpRemoted.ProcessBrowserRequest(BrowserCommand command, String requestId)
   at ArtOfTest.WebAii.Core.Browser.ExecuteCommandInternal(BrowserCommand request)

Then i saw the images captured at the time of failure, "expected state image" is showing Second Popup window and "state captured at time of failure" is showing empty i.e no image was there.

so how to get the focus on to the second popup window?
0
Plamen
Telerik team
answered on 25 Jan 2013, 09:38 AM
Hello Venugopal,

Unfortunately without a local repro of this behavior it's not possible to say why this is not working on your side. Please provide the means to reproduce the issue locally(either in your app or on a public site), so we can try to determine what is causing the problem.

All the best,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Venugopal
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Venugopal
Top achievements
Rank 1
Share this question
or