18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
How to handle new browser window page - Sahi using Java
Hi,
I am automating my application and facing an issue.
There is print link on the web page. After clicking on this link, it opens in separate browser window (this is not popup). I want to close this browser window and back to original browser window.
Please suggest how I will do that. I am using Sahi with Java language.
Browser - Firefox 6.0
OS - XP/Win7
Regards,
Dhirendra Jha
I am automating my application and facing an issue.
There is print link on the web page. After clicking on this link, it opens in separate browser window (this is not popup). I want to close this browser window and back to original browser window.
Please suggest how I will do that. I am using Sahi with Java language.
Browser - Firefox 6.0
OS - XP/Win7
Regards,
Dhirendra Jha
This discussion has been closed.
Comments
you can use
public void kill()
which kills the browser instance
Thanks for the reply. I tried using kill() method but it kills both the instances i.e original page and the newly open page.
Regards,
Dhirendra Jha
Since it is not a popup window you wont be able to automate this.
Regards
Sumitra
Thanks for the reply.
In that case I want to bring the focus on main window means want to show the main window on screen after new window page appears. I tried focus method but that did not work as focus works on elements only.
Please suggest what I will do for this. I have switched from Selenium to this tool as this is much easier in comparison with Selenium.
Regards,
Dhirendra Jha
Can you post the URL of the application?Can you post the screenshot of the application after you click on the print link.
Regards,
Theeran.
When I click on the print link then it shows the new firefox window. After that I am unable to close this newly open window.
Link - [browser.link("Print this").click();]
Newly Window URL - <AppUrl>/noFrame/mgraphPrintAction.do
One more thing, the window name is same for main application and newly open window.
Regards,
Dhirendra Jha
Considering what ever you have mentioned, could you please Ctrl+Hover on any of the elements on the newly opened window and check if Sahi is able to identify the elements.
If Sahi is able to identify the elements on the newly opened window you can use :
browser.popup("popWin").close(); This will close the newly opened window.
If Sahi is not able to identify the elements on the newly opened window then can you please send us the screenshot of newly opened window and then main application to support@sahi.co.in.
Regards
Sumitra
Thank you so much. Now the issue has been resolved. Actually the main problem was - the window name is same for main application and newly open window. I clicked on another link on main window and then tried to close the popup window and it closed.
Thanks once again.
Regards,
Dhirendra Jha