adspace
how can i pass a "cript"as a parameter in to a function
Answer Posted / Gautam Sinha
In QTP, you cannot directly pass JavaScript code (script) as a parameter into a function. Instead, you should write your script in the Test Script and use VBScript to call the functions. Here's an example of how to define a function and call it:
```
Function myJavaScriptFunction()
' Calling JavaScript function from VBScript
Dim objReference
Set objReference = CreateObject("ADODB.Stream")
objReference.Type = 2 ' adTypeText
objReference.Open
objReference.WriteText "<your JavaScript code>"
objReference.Position = 1
myJavaScriptFunction = eval(objReference.ReadText(-1)) ' Assign the result of JavaScript function to a VBScript variable
objReference.Close
End Function
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
write script for bitmap image?
hi frinds i need help .i have 4 + yrs exp in testing and nearly 2 yrs exp in QTP and QC .currently iam working north fast 2 yrs iam looking for job in south is there any openings plz letme know my mail id is pbre1980@gmail.com
what kind of frame work you used in your last project?
I am in .Net development for past 3.5 years and want to enter in to automated testing and learn QTP. For this I need some good tutorial for beginners. I will be really greatful if any one has and they can send it to me on this address- ruchidureja@gmail.com
Hi, how can we check or avoid the memory leakage in QTP9.2?
I want to open a Notepad window without recording a test and I do not want to use System utility Run command as well. How do I do this?
When to use shared and local object repository?
Any body have QTP 9.5 licence key. please provide me at madhukar_dec30@yahoo.co.in
Define Environment Variable in UFT and its uses?
what type of framework u r using in ur organization
Hybrid framework supports Descriptive programming. Is it true?
What is the new version of qtp which is recently released in the market?
Tell some commonly used Excel VBA functions?
Hi friends did any budy attend accenture system test for qtp? if any budy pls drop questions.not only accenture any other mnc company which you attended system test(QTP)?it may helpful to others also
How software tester can use constants and variables in scripts?