Forum Discussion

amathews's avatar
amathews
Occasional Contributor
13 years ago

Window invisible error intermittently on Remote Desktop ONLY when it's minimized

Okay, so I have a suite of TestComplete tests running on a separate testing computer with Hudson continuous integration server running the command line TestExecute:

start /wait "TestExecute" "C:\Program Files\Automated QA\TestExecute 8\Bin\TestExecute.exe" "C:\TestCompleteFiles\testcomplete\AdminProjectSuite\AdminWs_TrxGen_qa-luat\AdminWs_TrxGen1.pjs" /r /e



This works just fine normally; I can just click the "Build" button in Hudson and the command line runs on the test computer and runs the tests.  I usually access the test computer through Windows Remote Desktop program, which I'll have minimized but check periodically to see how my test regression suite is going on the test computer.  But many times, for my OpenIEAndGoToURL script (below), the script bombs at the page.toURL(testURL) step with:











The 'Google - Windows Internet Explorer' window is invisible and thus cannot be activated.




BUT this only happens when I'm not watching it.  If I tell it to run again but watch it through the Remote Desktop window, this error NEVER happens.  Also, I have Waits built into my script that "should" only let the script move forward with the window is visible.  Any idea what could be going on with this?





function OpenIEAndGoToURL(testURL)

{

 

  var p;



  var  page;

  atURL = false;

for(var z = 0; z < 5 && !atURL; z++)

{

  CloseIEifExists();

  try

  {

  //Options.Web.TreeModel = "Tree";

  //Log.PushLogFolder(Log.CreateFolder("Default Browser Launching"));

  WinExec(BuiltIn.GetCOMServerPath("InternetExplorer.Application"), SW_MAXIMIZE);

  p = Sys.WaitProcess("iexplore", 15000);

  if (!p.Exists)

  {

    Log.Error("Could not start Internet Explorer");

    Log.PopLogFolder();

    return(-1);

  }

 

  page = p.Page("*");  

  page.Wait();

  pageInvisible = true;

  for(var i = 0; i < 30 && pageInvisible; i++)

  {

  if(page.Visible && page.VisibleOnScreen)

   pageInvisible = false;

  else

    Delay(1000);

  }

  Delay(1000);

  thePage = page.ToURL(testURL);

    //wait for page to load after going toURL

  page.Wait();

 

  if(thePage.Exists)

    atURL = true;

 }

 catch(e)

 {

 

 }

}

    //return the current open web page

  return page;    

}

3 Replies