how can i pass a "cript"as a parameter in to a function
Answer / 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 |
I am having major problems with some DB Table Checkpoints I add to my script. I 35 web based applications recorded and each has DB Table Checkpoints insert but only 1 script isn't recognizing the DB Table Checkpoints for some reason. I've checked the DB connections and the info in the Library Functions and still only this one script out of 35 doesn't recognize the DB Table Checkpoints. Can someone please help me figure out why only this one script out of 35 that's hitting the same database is having a problem.
What is difference between QTP 8.2 Obect Repository and QTP 9.2 object Repository?
WHat is Object Identification and Object Spy?
Can you brief the hurdles you faced during Automation testing?
hai, i am doing QTP by own. So, i am confident in checkpts,synchronization, data driven test, recovery scenarioe manager etc. but actually i don't know how all these we wil implement while we r writting code manually. when we r doing practice, while recording code is automatically generated but in real time i heard that we have to write the script.But i don't know how it is? How to write descriptive prog.? plz. tel me what r the basic things we have to know? explain how to write descriptive prog.? explain me with an example pls.......
Hi, I am using OutputCheckPoint and I am storing the value in the data table. The stored value for column:bedroom:"Bed:4" The another value for column:bathroom:"Bath:2 Full,1 Partial" I need only the no 4 from the first column. I need only the no 2,1 from the second column. I used split array,but it also show array(0) has the value"bed:4" ..... Even though I highlight only 4,It is seleting the full value "bed 4".How can I get only the nos Thank you Uma
Suppose i have given 10 test cases all the test cases should be automated?
Hi PLZ explain User Defined Functions in QTP with eample?
Explain the difference between check point and output value?
if the excel sheet specified in script is not there,we get run time error how to handle the error ,please anybody explain me in detail
what is the Descriptive Progarmming? how it is help to testers in QTP?
explain how to write vb script in qtp?when will you write own script?