I had a similar issue with script completly freezing because of a Browser security dialog that was modal...
The Runner method helped me catch that dialog and dispose of it properly so script could continue...
// Checks whether the specified URL is valid
function VerifyWebObject(link, expectedObjectData)
{
var myProcess = Sys["FindChild"]('ProcessName','TestExecute',1);
if (!myProcess["Exists"])
var myProcess = Sys["FindChild"]('ProcessName','TestComplete',1);
var ellapsed = HISUtils["StopWatch"];
ellapsed["Start"]();
try {
// Do something
var httpObj = Sys["OleObject"]("MSXML2.XMLHTTP.3.0");
httpObj["open"]("GET", link, false);
var w = Runner["CallObjectMethodAsync"](httpObj,"send");
//httpObj["send"]();
}
catch (e) {
// Posts an exception message to the test log
Log["Error"](e["description"]);
return false;
}
finally
{
while (httpObj["readyState"] != 4) {
var thisWindow = myProcess["WaitWindow"]("#32770", "*", 1,100);
if (thisWindow["Exists"]) {
Log["AppendFolder"]("Capture de popup");
var thisImage = thisWindow["Picture"]();
Log["Picture"](thisImage,"Screen capture", "Ready State = 1");
var thisBtn = thisWindow["FindChild"]('Name','["Window"]("Button", "*Oui", 2)',5);
if (thisBtn["Exists"] == false) // Environnement anglais
var thisBtn = thisWindow["FindChild"]('Name','["Window"]("Button", "*Yes", 2)',5);
thisBtn["Click"]();
Delay(500); // Pour donner le temps de poursuivre le chargement après la fermeture du popup.
Log["PopLogFolder"]();
}
}
}
ellapsed["Stop"]();
try {
// Do something
var content = httpObj["responseText"];
}
catch (e) {
// Posts an exception message to the test log
Log["Error"](e["description"]);
return false;
}
switch (httpObj["status"])
{
case 200:
if ( content != expectedObjectData)
{
Log["Message"]("Temps réponse : "+ellapsed["ToString"]());
Log["Message"]("Le lien " + link + " est valide", aqString["SubString"](httpObj["responseText"],1,200));
return true;
}
break;
case 302:
if (content != expectedObjectData)
{
Log["Message"]("Temps réponse : "+ellapsed["ToString"]());
Log["Message"]("Le lien " + link + " est valide", aqString["SubString"](httpObj["responseText"],1,200));
return true;
}
break;
default:
Log["Message"]("Temps réponse : "+ellapsed["ToString"]());
Log["Warning"]("Le lien " + link + " est invalide et retourne un status: " + httpObj["status"], httpObj["responseText"]);
return false;
}
return true;
}