Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


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

I would like to directly import XL file and work on that XL file directly in QTp script in that XL sheet need to allocate workbench,XL sheet and generate two bar graphs automatically how to do that? plz let me know any answers?

0 Answers   Wipro,


What is the difference between action & script?

3 Answers  


Explain how you can find the absolute value of the number in qtp?

0 Answers  


How i can use and create Library functions in QTP and what is the proces .

2 Answers  


Hi frnds, for ex.. we got a job in wipro, they will give me one mail id.. "Rameshkumar@wipro.com", where to open this mail id..in which sw ? or outlook?

1 Answers  






if devloper change only button names in present build then script will execute or not , why? Only gui changed.......

2 Answers   Cap Gemini,


I have a login page like username, password and login. I have to pass the 50 user names and 50 passwords but how can i test this page with out using parameters?

2 Answers  


is it possible to operate(on/off)the capslock using qtp

2 Answers  


Does Low-level recording capture mouse movements?

0 Answers  


what is web application and client server application.is there any difference ?

1 Answers   Wells Fargo,


hi,i have a pblm in qtp,im testing an webappl in which different types of error pop up messages are displayed which qtp is not differentiating or it is not recognising. how do i make it recognise different popup errorm messages while writing script?

4 Answers  


I m trying to automate one vb desktop application in that there is vblist vbcombobox many other vb tools are there ,when i m trying to find some unique property to identify the object (take example of vbcombobox ) I cannot find any unique property, all the combobox belong to same nativeclass same name no ids are available ,only the distinct property is there x and y coordinates so i m using some code like this "vbbutton "nativeclass:=ThunderRT6CommandButton","x:=304","y :=443").exist(2)" but i dont find them reliable .Can anyone suggest me some other way to identify those objects with some unique property or is there any way to register our own property .I m using descriptive programming to write the code .Thanks in advance

6 Answers   Cimcon,






Categories