Forum Discussion

jrm0384's avatar
jrm0384
New Contributor
8 years ago
Solved

Cannot obtain the window with the window class '#32770' TWICE

Hello,

currently I'm testing a web app developed in Silverlight 5 with Testcomplete 10 running on IE 10.
I'm using a function to upload files and I get the next error:
 "Cannot obtain the window with the window class '#32770', window caption 'Open' and index 1"

The problem in my case is that the function works fine JUST ONCE.
The second time I call the function is when I get the error.

 

function uploadFileHndl2(prStrFilePath){
 
  popup = Aliases["browser"]["Window"]("#32770", "Open", 2);
  txtFileName = Aliases["browser"]["Window"]("#32770", "Open", 2)["Window"]("ComboBoxEx32", "", 1)["Window"]("ComboBox", "", 1)["Window"]("Edit", "", 1);    
  txtFileName["wText"] = prStrFilePath;
  btnOpenFile = Aliases["browser"]["Window"]("#32770", "Open", 2)["Window"]("Button", "&Open", 1);
  Log["Event"]("Select the file to attach");
 
  if(btnOpenFile["Exists"]){
    btnOpenFile["Click"]();
    Delay(500);
  }
  else{
    Log["Message"]("Red Code!!!!");
  }
}


Thanks,

  • Try this:

    function uploadFileHndl2(prStrFilePath){
      popup = Aliases["browser"]["Window"]("#32770", "Open", 2);
      txtFileName = Aliases["browser"]["Window"]("#32770", "Open")["Window"]("ComboBoxEx32", "", 1)["Window"]("ComboBox", "", 1)["Window"]("Edit", "", 1);    
      txtFileName["wText"] = prStrFilePath;
      btnOpenFile = Aliases["browser"]["Window"]("#32770", "Open")["Window"]("Button", "&Open", 1);
      Log["Event"]("Select the file to attach");
     
      if(btnOpenFile["Exists"]){
        btnOpenFile["Click"]();
        Delay(500);
      }
      else{
        Log["Message"]("Red Code!!!!");
      }
    }

4 Replies

  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor

    Try this:

    function uploadFileHndl2(prStrFilePath){
      popup = Aliases["browser"]["Window"]("#32770", "Open", 2);
      txtFileName = Aliases["browser"]["Window"]("#32770", "Open")["Window"]("ComboBoxEx32", "", 1)["Window"]("ComboBox", "", 1)["Window"]("Edit", "", 1);    
      txtFileName["wText"] = prStrFilePath;
      btnOpenFile = Aliases["browser"]["Window"]("#32770", "Open")["Window"]("Button", "&Open", 1);
      Log["Event"]("Select the file to attach");
     
      if(btnOpenFile["Exists"]){
        btnOpenFile["Click"]();
        Delay(500);
      }
      else{
        Log["Message"]("Red Code!!!!");
      }
    }
  • Hello,

     

    popup = Aliases["browser"]["Window"]("#32770", "Open", 2);

     

    Instead of using hard coded index 2 use "*" (RegEx). It works everywhere.

     

    Regards,

    Mayank