Forum Discussion
tristaanogre
14 years agoEsteemed Contributor
The method not showing up in your first example does not mean that the method cannot be used.
The difference is in how the script is interpreted by the parser. Because the variables are declared outside of a function, they are not resolved unit run time so they don't show up in Code Completion. If the variable is referenced inside the function, they resolve in the parser and you can access them.
A better way of doing this, though, might by to use Aliases to shorten your calls. If done properly, you could simply have
Or, you could even reduce your alias down to
Using Aliases, then, you can get rid of your Interface section in your code because then all your component aliasing is handled by TestComplete rather than in code and then your CodeCompletion works every time.
The difference is in how the script is interpreted by the parser. Because the variables are declared outside of a function, they are not resolved unit run time so they don't show up in Code Completion. If the variable is referenced inside the function, they resolve in the parser and you can access them.
A better way of doing this, though, might by to use Aliases to shorten your calls. If done properly, you could simply have
Aliases.MainWindow.AddButton.ClickButton()
Or, you could even reduce your alias down to
Aliases.MainWindow_AddButton.ClickButton()
Using Aliases, then, you can get rid of your Interface section in your code because then all your component aliasing is handled by TestComplete rather than in code and then your CodeCompletion works every time.