Closing pop-up with modified URL
1 Answer 16 Views
Jessica
Top achievements
Rank 1
Jessica asked on 29 Apr 2021, 06:01 PM

Hello, 

I'm using the connect to popup dialog to connect to a browser that is launched when clicking a link. I then do some actions in the second  tab which changes the URL, I then need to close the second browser, do I use the close popup dialog to close the second tab and just put the now chanced URL or do I use the URL I connected to. Right now I put the modified url in the close popup dialog, but sometimes it doesn't close the new browser tab and shift focus back to the first browser tab. 

I'm aware I can use a coded step to close that second tab, and use Manager.Browsers.count to count the tabs to ensure that second tab does close as long as I do a global browser count variable. If you believe that's the best way to go I can do that, but I wanted to make sure I was approaching it correctly.

Hi Jessica, I tried to reproduce the encountered issue on my end, by following the details you shared, and tested it across all supported browsers. The "Close pop-up" step works in Internet Explorer, even if that tab's URL was changed, but it does not work as expected on the other browsers (Chrome, Edge Chromium and Firefox). 

I will involve some of the developers to investigate this behavior further and will get back to you in this thread. This might take several days, since we have a lot of holidays this week and most of the team is not available. So, I will get back to you with more details by the beginning of next week. Thank you for the understanding!

- by
Plamen Mitrev
Telerik team
on 03 May 2021, 08:11 AM

1 Answer, 1 is accepted

Sort by
0
Accepted
Plamen Mitrev
Telerik team
answered on 07 May 2021, 08:47 AM

Hi Jessica,

Thank you for allowing me additional time to investigate this issue, where the tab is not closed successfully. It turned out that there are changes in some of the latest updates of all JavaScript browsers (Chrome, Firefox and Edge Chromium), which are causing troubles with this functionality. I created a public bug report on your behalf and our engineering team will look for a solution to add in some of our next releases. Please add your vote to the public item and follow it to get notifications for its progress.

In the meantime, I prepared a sample Test Studio project with one web test that reproduces the issue. I added a coded step, in place of the "Close Pop-up window" step that is typically used, to close the second tab by pressing the "Ctrl + W" key combination. Note that in order to send desktop keyboard actions, you need to add a reference to System.Windows.Forms to the Test Studio project and coded step. Please find the attached project and sample code below.

            Manager.ActiveBrowser.Window.SetFocus();
            
            Manager.Desktop.KeyBoard.KeyDown(Keys.Control);
            Manager.Desktop.KeyBoard.KeyPress(Keys.W);
            Manager.Desktop.KeyBoard.KeyUp(Keys.Control);

I hope that the above mentioned workaround will help you automate this scenario, while we are looking for a solution for the "Close Pop-up window" step. I remain available to continue our discussion and assist you further, if needed.

Regards,
Plamen Mitrev
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Test Studio course! Check it out at https://learn.telerik.com/.
Hello Plamen!

Thank you so much for your help. I will give this work around a try and let you know if I see anything else on the bug report.

Best, Jessica
- by
Jessica
Top achievements
Rank 1
on 12 May 2021, 07:55 PM

Hi Jessica, I hope that it works for you as well as it did on my end, during testing. Of course, let me know if you encounter any troubles.

Have a great day ahead!

- by
Plamen Mitrev
Telerik team
on 13 May 2021, 09:12 AM
Asked by
Jessica
Top achievements
Rank 1
Answers by
Plamen Mitrev
Telerik team
Share this question
or