We are building a new experience for our SmartBear Community.
This site is now read-only. You can still browse and search as usual. Learn More
This site is now read-only. You can still browse and search as usual. Learn More
CAn we pass an object as an argrument of a function that is declared in another unit.
like
Unit1:
'USEUNIT Unit2
Sub Task()
Set Obj = ............whatever here........
Call Validate(Obj)
End sub
Unit 2:
Function Validate(value)
Value.Click 'here I want to check properties for "value".... but getting errror "Object is required"
End Function
How can I pass object and use their properties in another unit. ?
When you get to the second function, you need to use something like eval() to tell it that what you passed isn't just a string. There's an example in here:
https://support.smartbear.com/testcomplete/docs/scripting/calling-routines/declared-in-another-unit/jscript.html
When you get to the second function, you need to use something like eval() to tell it that what you passed isn't just a string. There's an example in here:
https://support.smartbear.com/testcomplete/docs/scripting/calling-routines/declared-in-another-unit/jscript.html
Hi Kaiiii,
how about defining a variable of the object type on project level or project suite level, using that to store your object and as parameter for your function Validate.
Regards
S_Seydel
Hi,
The sceleton of your code looks correct.
Most probably, as the text of the error says, object is not assignrd to the Obj variable and thus the code in the Validate() function cannot access object's properties.