Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, windows and java based applications. Get your 30 day free trial.
Discuss your Sahi Pro usage patterns, best practices, problems and solutions. Help others solve their problems and seek help from the community when needed. If you need specific support on your application, please email support @ sahipro.com
Discuss your Sahi Pro usage patterns, best practices, problems and solutions. Help others solve their problems and seek help from the community when needed. If you need specific support on your application, please email support @ sahipro.com
Accessing a popup which was header located
In a web sie, I generate a PDF inside a popup.
- If the generation succeeds, I header('Location:... to the generated file
- If the generation fails, I get an HTML page instead saying "Error #..."
The problem is that, once the popup is opened, and header('Location:... done, it looks like Sahi does not recongnize the popup anymore. I get :
Questions :
1- How is it possible to close the PopUp ?
2- To test if the PDF generation did not fail, the line
// _assertNotContainsText("ERROR #", _popup("win2").document.body);
should be uncommented. But how this line will behave when the PDF was in fact generated, creating a page with no "document.body". Should I use
try{
...
}catch(e){
...
}finally{
...
}
in that case ? How ?
Just to mention that the code works pergect when genrating HTML instead of PDF.
- If the generation succeeds, I header('Location:... to the generated file
- If the generation fails, I get an HTML page instead saying "Error #..."
The problem is that, once the popup is opened, and header('Location:... done, it looks like Sahi does not recongnize the popup anymore. I get :
Error in script: _popup("win2")._closeWindow();
Window/Domain not found: popupNameFromStep=win2; derivedName=; windowName=; windowTitle=All projects; wasOpened=0; domain=
--Stopped Playback: FAILURE--
Here is the .sah
_click(_link("PDF"));
_wait(3000);
// _assertNotContainsText("ERROR #", _popup("win2").document.body);
_popup("win2")._closeWindow();
Questions :
1- How is it possible to close the PopUp ?
2- To test if the PDF generation did not fail, the line
// _assertNotContainsText("ERROR #", _popup("win2").document.body);
should be uncommented. But how this line will behave when the PDF was in fact generated, creating a page with no "document.body". Should I use
try{
...
}catch(e){
...
}finally{
...
}
in that case ? How ?
Just to mention that the code works pergect when genrating HTML instead of PDF.
Comments
Could you please try using:
_popup("All Projects")._closeWindow(); and check if this solves your issue.
If the above usage doesn't solve your issue,then kindly send the source code of the popup window to support@sahi.co.in
Regards
Sumitra
Thank you for your advice.
_popup("All Projects")._closeWindow() will not close the window,
but this time, the script will continue on, and no error are raised,
which is an acceptable behaviour, as it allows to see the result
From the IDE, it stays open until closed manually.
From a .BAT, it closes at the end at the same time as the main window,
except when another instance of Firefox is open.
In that case no window will close automatically.
(This behaviour is the same when there is no pupup)
_popup("popupname")._closeWindow(); should be able to close the popoup window.
Could you please send the screen shot and the source code of the popup.
Regards
Sumitra