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.
Issue with Popup window
Hi,
Clicking on a link in my script will open a popup window. Then name of the popup window present in this method: _popup("Name is not constant") is not constant. I have to verify whether a textbox exists in this popup or not.
I can put assert on this for textbox but script fails because the name of the popup window changes whenever it is opened.
Is it possible to get the popup window name from the click in parent which generates this new popup window?
Or if there is any other workaround?
Thanks
Clicking on a link in my script will open a popup window. Then name of the popup window present in this method: _popup("Name is not constant") is not constant. I have to verify whether a textbox exists in this popup or not.
I can put assert on this for textbox but script fails because the name of the popup window changes whenever it is opened.
Is it possible to get the popup window name from the click in parent which generates this new popup window?
Or if there is any other workaround?
Thanks
Comments
If there is only one popup window open, you could use _popup("/.*/") to identify it. (That is a regular experssion to match any text)
Regards,
Narayan
I have 2 popup on my screen. one has a window title but the other one doesn't. How can i select the one without any name?
I tried _selectWindow() but apparently this function doesn't take regular expression. It only works with the exact popupname.
How should I handle this ? I have looked so many post but this one seems to be close to my case so I will be glad if anyone has a solution here.
Thanks in advance.
Kindly try with this:
_popup(identifier)
The identifier can be a regular expression.
Regards
Sumitra
Yes tried it already but not working with regular expression :
the popup doesn't have a name. It's a IFrame, I believe. I tried several thing to identify the iframe but without any success.
Look at the code if this can help you to help me out :
<A href="JavaScript:ImprimeFacture()">test</A>
<SCRIPT LANGUAGE="JavaScript">
function ImprimeFacture()
{
ChargerImp();
}
function ChargerImp()
{
AElement = document.getElementById("idCalqueEnregistrementEnCours");
std_cacherObjet(AElement);
document.IFrmSaisieImp.location.href = ''http://monsite/scripts/copitole.dll/ChargerImp?SessionId=fl{587}179h';
AElement = document.getElementById("Impression");
std_montrerObjet(AElement);
Pos_IFrameCache("Impression");
}
function ValidImp()
{
//Appel des fonctions de validations de l'iframe
document.IFrmSaisieImp.ValidSaisieImp();
}
function SetFocusImp()
{
document.IFrmSaisieImp.SetFocus();
}
function ValiderFrameOK(NomDiv)
{
//On ferme la div
Fermer(NomDiv);
Active_Saisie("IFramePage");
if (NomDiv=='Impression')
{
//On montre la div enreg
AElement = document.getElementById("idCalqueEnregistrementEnCours");
std_montrerObjet(AElement);
try
{
document.FmRecherche.TraitementAFaire.value='Imprimer';
document.FmRecherche.submit();
}
catch(e)
{
alert('Impossible de lancer le traitement');
std_cacherObjet(AElement);
}
finally
{
std_cacherObjet(AElement);
}
}
}
</SCRIPT>
<div ID="Impression" STYLE="position:absolute; filter: alpha(opacity=100); width:400px; height:250px; z-index:200; left: 100; top: 50; background-color: #DEE3FD; layer-background-color: #DEE3FD; border:inset 1px #2D376D;visibility: hidden" >
<div id="BandeauImp" onmousedown="BeginDrag('Impression')" onmouseup="FinDrag();">
<img SRC="BandeauOk_400_2.gif" WIDTH="400" HEIGHT="21" usemap="#MapBandeauImp" Name="BandeauImp" border="0" >
<map name="MapBandeauImp">
<area shape="rect" coords="1,1,286,21" onclick="FinDrag()">
<area shape="rect" coords="287,1,311,21" href="#" onclick="Javascript:ValidImp();">
<area shape="rect" coords="314,1,374,21" href="#" onclick="Javascript:SetFocusImp();" >
<area shape="rect" coords="377,1,393,21" href="#" onclick="Javascript:Fermer('Impression');Active_Saisie('IFramePage');globale_enregistrementEnCours = false" >
</map>
</div>
<div id="ImpSaisie" >
<iframe id="SaisieImp" name="IFrmSaisieImp" src="#" ALIGN=TOP WIDTH="100%" FRAMEBORDER="0" BORDER="0" SCROLLING="NO" STYLE="z-index:50;"></iframe>
</div>
</div>
code of the iframe itself :
function LoadBody()
{
if (document.forms(0).TrtEditique.value == 'oui')
{
document.getElementById("idTrtEditique").style.display = "block";
}
else
{
document.getElementById("idTrtEditique").style.display = "none";
}
//fin CBC 29/10/2007
ResizeDiv('Impression','SaisieImp');
ATable = document.getElementById('TablePrinc');
ATable.height = 350;
ReduirePage();
init();
document.forms(0).LiImprimante.focus();
if (document.forms(0).Reload.value == 'oui')
{
document.forms(0).EdDateImp.focus();
document.forms(0).LiImprimante.disabled = true;
document.forms(0).CbEditique.disabled = true;
document.forms(0).EdPreview.disabled = true;
}
}
function forcerPdf()
{
if (document.forms(0).CbEditique.checked) {
document.forms(0).EdPreview.checked = true;
}
}
</script>
<body cellspacing="0" cellpadding="0" bgcolor="#DEE3FD" onLoad="LoadBody()" onmousemove="DragEnCoursEnfant();">
<!--<script src='LibChild.js'></script>-->
<!-- gestion des bulles-->
<DIV class=popper id=topdeck></DIV>
<SCRIPT src='LibCopNet.js'></SCRIPT>
<!--Calendrier-->
<script src='LibCopCalendar.js'></script>
<!-- -->
<TABLE id="TablePrinc" border="0" cellspacing="0" cellpadding="0" width="400" >
<FORM METHOD="GET" NAME="FmParamImp" >
<INPUT TYPE="hidden" NAME="SessionID" VALUE="fl{587}179h" >
<INPUT TYPE="hidden" NAME="DateSysteme" VALUE="29/04/2011" >
<INPUT TYPE="hidden" NAME="HeureSysteme" VALUE="17:17" >
<INPUT TYPE="hidden" NAME="HeureSystemeReplanif" VALUE="17:17" >
<INPUT TYPE="hidden" NAME="Reload" VALUE="" >
<INPUT TYPE="hidden" NAME="TrtEditique" VALUE="" > <!-- CBC 29/10/2007 : Editique -->
<TR>
<TD WIDTH="100%" VALIGN="top">
<TABLE BORDER="0" WIDTH="100%" CELLSPACING="0">
<TR>
<TD WIDTH="100%" class="titre">Paramètre d'impression</TD>
</TR>
<tr>
<td width="100%">
<table border="0" width="100%" cellspacing="0">
<tr>
<td width="64%"><p align="right"><font class="def"><i>Les champs marqués</i></font></td>
<td width="5%"><img border="0" src="http://ICOP-TMA5.rm.corp.local/images/obligatoire.gif" width="10" height="10"></td>
<td width="31%"><p align="left"><font class="def"><i>sont obligatoires</i></font></td>
</tr>
</table>
</Td>
</tr>
<tr>
<td width="100%">
</Tr>
<TR>
<TD width="100%">
<TABLE BORDER="0" WIDTH="100%" CELLSPACING="0">
<TR>
<TD WIDTH="40%"><font class="def">Imprimante</font> <img src="http://ICOP-TMA5.rm.corp.local/images/obligatoire.gif" width="10" height="10"></TD>
<TD WIDTH="60%"><font class="policesaisie"><SELECT SIZE="1" NAME="LiImprimante"><OPTION VALUE="LAM" SELECTED>Imprimante TMA AM</OPTION></SELECT></font></td>
</TR>
<tr>
<td width="40%"><font class="def">Avec prévisualisation</font></td>
<td width="60%"><input type="checkbox" name="EdPreview" onclick="if (document.forms(0).CbEditique.checked){return false}" ></td>
</tr>
<tr>
<td width="40%"><font class="def">Date et heure du système</font></td>
<td width="60%"><font class="policesaisie">29/04/2011 17:17</font></td>
</tr>
<tr>
<td width="40%" class="def">Date et heure d'exécution</td>
<td width="60%">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td width="40%"><input size="10" name="EdDateImp" tabindex="6" value="" genre="DATE" maxlength="10"></td>
<td width="10%" align="left"><a href="javascript:void(0);" onclick="AggrandirPage();popUpCalendar(this, document.forms(0).EdDateImp, LongDateFormat,90,0);"><img src="http://ICOP-TMA5.rm.corp.local/images/calendar.gif" border="0" style="cursor: hand"></a></td>
<td width="50%"><input type="text" size="5" genre="HEURE" tabindex="7" name="EdHeureImp" maxlength="5" value="" onblur="SaisieHHMM(document.forms(0).EdHeureImp);"></td>
</tr>
</tr>
</table>
</td>
</tr>
<!-- CBC 29/10/2007 : Editique -->
<tr id="idTrtEditique">
<td width="40%"><font class="def">Traitement éditique</font></td>
<td width="60%"><input type="checkbox" name="CbEditique" onclick="forcerPdf()" ></td> <!--SVA 17/09/08-->
</tr>
<!-- fin CBC 29/10/2007 -->
</TABLE>
</TD>
</TR>
</table>
</td>
</tr>
</form>
</table>
<div id="idCalqueEnregistrementEnCours" style="position:absolute; width:253px; height:80px;
z-index:10; left: 15px; top: 20px; border: 1px none #000000; visibility: hidden" class="cadreEnregistrementEnCours">
<img src="waiting3.gif" width="253" height="80">
</div>
</body>