How to make arguments optional in a function?

Answers were Sorted based on User's Feedback



How to make arguments optional in a function?..

Answer / ramchandra patil

Hi Narendra,

Good question!

See basically QTP does not support optional arguments but u
can achieve this with following ways-

1. You can pass NULL or Empty values
2. By using dictionary object


I am agree with Subbu...
@Meenu we use optional in front of statement if we wanted
to execute the statement at some criteria..we never use
Optional keyword while passing arguments to function...n I
think narendras question is related to function...

hey guys let me know if I am wrong with valid solution and
please do post if u know any other way..


Thanks in Advance..

Ramchandra
9699851282

Is This Answer Correct ?    2 Yes 0 No

How to make arguments optional in a function?..

Answer / akshay kumar

this is not possible as default VBS doesn't support this. Instead you can pass a blank scring and have a default value if arguments r not required.

Is This Answer Correct ?    0 Yes 0 No

How to make arguments optional in a function?..

Answer / murtaza j habib

make any function and call it anywhere in your file

but don't upload that function which showing you a error in
your file because it is useless

Is This Answer Correct ?    0 Yes 1 No

How to make arguments optional in a function?..

Answer / subbu

In QTP we dont use "Optional" keyword just like in VB.
But work around is use Dictionary object. It is just like
multi dimension arrays.

Is This Answer Correct ?    0 Yes 1 No

How to make arguments optional in a function?..

Answer / sushma

Suppose there is alogin window in the user name we can type
any thing but while running its giving som eerror we can
avoid tht error actually
so, we can make tht tsl as an optional so tht if an error
occurs it countinues but not stop
for example
Optional.Dialog("Login").WinEdit("Name:").Set "ssss"
these line make an optional now

Is This Answer Correct ?    1 Yes 7 No

How to make arguments optional in a function?..

Answer / meenu

basically by prefixing 'Optional.' in front of the statement

Is This Answer Correct ?    0 Yes 7 No

Post New Answer

More QTP Interview Questions

how to record a word doc using qtp i.e open a word doc,type something and save the doc can someone send me the code.

3 Answers  


1.How recognize QTP Dyanamic Image? (suppose tha wedpage contains 3 logos..1 square 2.circle 3.rectangel)there changing at same position how to capture that)

3 Answers   Synechron,


Does UNIX support QTP? If not what is the other tool used for Unix environment?

2 Answers   Amdocs, Fidelity,


do you prepared framework,pls answer this

1 Answers  


Explain the QTP Tool interface.

2 Answers   Crea,






Hi any body pls help me for QTP 11.0 software free demo version. i have to practice. Kindly send the link.or where i have to download.

0 Answers  


please give me the code for doing retesting of gmail login page using functions so the function has to give the value

0 Answers  


How to supress warnings from the "Test results page"?

4 Answers  


How can you capture(Read) the values from a Table?

1 Answers  


Hello Everybody, How to maintain the page state in QTP. My scenario is: 1. I opened a notepad file. 2. Entered some text in the notepad file. 3.And changed the font type and color of the notepad file. And saved that. 4.Now next time when I will open the notepad it is showing the changed font type and color, rather than the default values. Please provide the code. Thanks, Gaytri

5 Answers  


hi friends i have 4 yrs exp in testing and 2 yrsexp in QTP.currently aim working in mnc in north as a permanent employer .iam looking for job in south is there any openings plz let me know my mail id is bjr@aol.in its very urjent

5 Answers  


What is a Dictionary object in QTP.?

1 Answers   Cap Gemini,


Categories