Ask a Question

Error while executing "Execute" method in test complete.

paramveer
Contributor

Error while executing "Execute" method in test complete.


 



 





Hi



objectFullNameString is a object having fullname of object.





 



 



Execute objectFullNameString &"."& "CheckItem("&"""|Sectors|LZONE Classification|Banks|Axis Bank Ltd"""&", True)"



When we are executing the Execute Method system is giving following error.



"Microsoft VBScript compilation error."

"Cannot use parentheses when calling a Sub"



Please suggest what to do in this case





Thanks in advance

Param




 


1 REPLY 1
HKosova
Moderator

RE: Error while executing "Execute" method in test complete.

Hi,



Your string evaluates to something like this:



In VBScript, if you use parenthesis when calling a subroutine, you must also use the Call keyword. If you don't use the Call keyword, the argument list must NOT be surrounded by parenthesis.



So, you need to either use the Call keyword:

or remove parenthesis from the CheckItem method call:





By the way, a shorter and simpler way to do the same thing is to evaluate only the object itself rather than the whole statement:

Call Eval(objectFullNameString).CheckItem("|Sectors|LZONE Classification|Banks|Axis Bank Ltd", True)

' or

Eval(objectFullNameString).CheckItem "|Sectors|LZONE Classification|Banks|Axis Bank Ltd", True

Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
cancel
Showing results for 
Search instead for 
Did you mean: