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

could any help me please, how to work on visual foxpro application using UFT

0 Answers   NA,


how we connect 1. qtp9.2 to the quality center9.0? 2. Load runner8.0 to the quality center9.0

0 Answers  


What are the parameters provided by QTP?

3 Answers   Ordain Solutions,


what is the Exact Meaning of Environment Variables?

2 Answers   Semantic Space,


Does QTP work in UNIX environment

5 Answers   BirlaSoft, C1 India,






Hi All. Can you please explaing what is checkpoint? How it Will Work? what is meaning of "check checkpoint ("proprtname").how it will compate with expected value? Thanks in Advance............... Lakshmi

3 Answers   ITC Infotech, TCS,


How do you test siebel application using qtp?

2 Answers  


from where we will retrieve data for data driven tests in qtp?

3 Answers  


In ordinal identifier there r 3 options available. Which one will be enabled first when ordinal identifier is invoked.

3 Answers   Cap Gemini,


If u don't have any Knowledge on perticular application but they give that application to u for Testing ? Then How we wil move towards testing on that application?

16 Answers   Genpact, HP,


Hi friends, I have heard that it is required to have an application hosted in the same machine where we use QTP. Otherwise QTP may identify the objects incorrectly. Please clear me is it true.

3 Answers  


Why VB scripts are used in QTP and TSL in Winrunner, is there any advantage of using VB Scripts

2 Answers  


Categories