Forum Discussion

jzoest's avatar
jzoest
New Contributor
13 years ago

C#Script runtime error

Hello,



I want to test our installer with TestComplete. At some moment the installer pops up a separate tool in which you can select an appropriate network interface. This tool is written in C++ and contains a textbox in which the IP address is written. In my test I want to validate the address in this textbox. If the address is incorrect, the test will select a different interface via a combobox. I've made a C#Script for this (most of our installer is C# code):



function SelectNetworkAdapter()

{

  var lastResult;

  var ipText;

 

  ipText = Aliases["network_selector"]["dlgNetworkSelector"]["Edit"]["wText"];

  // ipText contains: "192.168.207.13 and is type String"

  lastResult = ipText["Contains"]("192.168.207.");

 

  while(lastResult == false)

  {

    // TODO: select different network interface

    ipText = Aliases["network_selector"]["dlgNetworkSelector"]["Edit"]["wText"]; 

    lastResult = ipText["Contains"]("192.168.207.");

  }

}



The ipText var actually contains the correct IP address when I debug the test, and it is of type String. However, when I try to call either C# or C++ functions on the string (like Equals, Contains, Find), it will give an "C#Script runtime error". It says "Object doesn't support this property or method".



Does someone know how to fix this? Or know a different solution to validate part of the textbox?



Thanks in advance!





3 Replies

  • Hi,



    Look like your problem is very simple one... Send me  the code snippet then i will suggest the solution.

    by the way  where are you calling string functions and send me that code snippet.



    I strongly belive that some where you making wrong way of calling...Please refer my previous posting on the same issue.





    Regards,

    Kumar
  • jzoest's avatar
    jzoest
    New Contributor
    Hi Tanya,



    Thank you very much, that solution worked!