jzoest
13 years agoNew Contributor
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!
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!