Micro Focus QTP (UFT) Forums
3 basic questions..please help - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: 3 basic questions..please help (/Thread-3-basic-questions-please-help)



3 basic questions..please help - Blizna - 01-24-2010

Hello,
I have just started to use QTP trial but struggle with following 3 points:
1)How to compare value of some web element (e.g. google - number of found results). Tried to use Val(WebElement) but it throws an error
2) Why I cannot use "Dim A as Integer"? I thought its just VB there.
3)Why debugging is still disabled except from Run to step and why breakpoints does not stop the test?

Thank you very much!


RE: 3 basic questions..please help - Saket - 01-25-2010

Hi Blinza,
Have you gone through QTP User guide /QTP tutorial? I would suggest you to go through QTP tutorial once before jumping to the scripting.
answer for your questions
1)How to compare value of some web element (e.g. google - number of found results). Tried to use Val(WebElement) but it throws an error
- to get the value for webelement or any object you should use 'GetROProperty'

2) Why I cannot use "Dim A as Integer"? I thought its just VB there.
QTP does not supports data types so you cant use 'as Data Type' all variables will be type of variant.

3)Why debugging is still disabled except from Run to step and why breakpoints does not stop the test?
more explanation required on what do you mean by 'still disabled', QTP tests stops at breakpoints, how did you used that?


RE: 3 basic questions..please help - Gizmos - 01-25-2010

Hi,
Regarding the debuging, I have the same problem. I place breakpoints to the code but the QTP ignores them. In the Debug menu, there are always all items disabled except for Run to step. Maybe due to trial version?


RE: 3 basic questions..please help - nistalaramesh - 01-25-2010

"Microsoft Script debugger" is not installed in your PC while you installed QTP. It is required. You just install script debugger then all tour options will get displayed and you can debug your script.


RE: 3 basic questions..please help - Kasanagottu - 07-09-2010

3) if "Microsoft Script debugger" is not installed in your PC debugging options will be in disabled mode.if u want enable that must while installing the Microsoft Script debugger.


2) Why I cannot use "Dim A as Integer"? I thought its just VB there

Ans :VBScript supports only one data type called ‘Variant’. The variant data type is a special kind of data type that can contain different kinds of information. It is the default data type returned by all functions in VBScript. A variant behaves as a number when it is used in a numeric context and as a string when used in a string context. It is possible to make numbers behave as strings by enclosing them within quotes.



RE: 3 basic questions..please help - sasmitakumari - 07-09-2010

2)Why I cannot use "Dim A as Integer"? I thought its just VB there

As others mentioned above VBScript supports only one data type called ‘Variant’. You just need to declare the variable without any data type, the value assigned to it determine its data type. Its usage determines its data type.
Ex:
Code:
Dim A, B
A = 23
msgbox A
A =  "as"
B = A
msgbox A
A =45

C= A
msgbox "B = "& B
msgbox "C="&Cstr(C)