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


Please Help Members By Posting Answers For Below Questions

write script for bitmap image?

2126


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

2162


what kind of frame work you used in your last project?

2420


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

2088


Hi, how can we check or avoid the memory leakage in QTP9.2?

2183


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?

1307


When to use shared and local object repository?

1169


Any body have QTP 9.5 licence key. please provide me at madhukar_dec30@yahoo.co.in

2090


Define Environment Variable in UFT and its uses?

1164


what type of framework u r using in ur organization

2161


Hybrid framework supports Descriptive programming. Is it true?

1245


What is the new version of qtp which is recently released in the market?

1168


Tell some commonly used Excel VBA functions?

1148


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

2406


How software tester can use constants and variables in scripts?

2361