Forum Discussion
sastowe
14 years agoSuper Contributor
I don't know what this means "But when i run the script i am getting run time error, since the objects are already read by the Test Complete".
You are probably getting a variable not defined error or some such. What is happening is that you are setting object reference variables. When you do this:
set wnd_Login=Sys.Process("DMS.GUI.uat1").WPFObject("HwndSource: LoginWindow", "DMS Client uat1 - log in")
You are setting a variable named wnd_Login. It's scope is where ever you declare it. So
Sub Test
Dim wnd_Login
set wnd_Login=Sys.Process("DMS.GUI.uat1").WPFObject("HwndSource: LoginWindow", "DMS Client uat1 - log in")
End
Or if Option Explicit not set, if no Dim statement, the scope of this variable is to the procedure Test.
If you did
Private wnd_Login
Sub Test
set wnd_Login...
End Sub
The scope is the entire unit. So if you declare them Private at the unit level, then do 'Useunit at the top of the second unit, you would have scoped them properly.
You are probably getting a variable not defined error or some such. What is happening is that you are setting object reference variables. When you do this:
set wnd_Login=Sys.Process("DMS.GUI.uat1").WPFObject("HwndSource: LoginWindow", "DMS Client uat1 - log in")
You are setting a variable named wnd_Login. It's scope is where ever you declare it. So
Sub Test
Dim wnd_Login
set wnd_Login=Sys.Process("DMS.GUI.uat1").WPFObject("HwndSource: LoginWindow", "DMS Client uat1 - log in")
End
Or if Option Explicit not set, if no Dim statement, the scope of this variable is to the procedure Test.
If you did
Private wnd_Login
Sub Test
set wnd_Login...
End Sub
The scope is the entire unit. So if you declare them Private at the unit level, then do 'Useunit at the top of the second unit, you would have scoped them properly.