Micro Focus QTP (UFT) Forums
How to add an object to repository through script - 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: How to add an object to repository through script (/Thread-How-to-add-an-object-to-repository-through-script)



How to add an object to repository through script - kp.naravi - 06-11-2008

Hi,

Is it possible to add an object to repository through script?
I have a requirement wherein, i need to add objects to repository dynamically .

Please help me in this regard.


Regards,
KP


RE: How to add an object to repository through script - niranjan - 06-11-2008

You can use Descriptive Programming.


RE: How to add an object to repository through script - namitarayudu - 06-11-2008

Can you please share with the sample code or function to use this option...

Thanks,


RE: How to add an object to repository through script - niranjan - 06-11-2008

(A)
Descriptive programming allows you to work with objects that are not stored in object
repository. two types of programmatic descriptions.
1) listing the set of properties and values that describe the object directly in a test
statement.
2) Add collection of properties and values to a Description object, and then enter the
Description object name in the statement.
In your case my suggestion was to use the second option. Yes, this does not add objects to OR but you can use the objects.


(B)
You can use SetTOProperty method of test object.
Object(description).SetTOProperty Property, Value
The values of test object properties are used to identify the objects. Sometimes the properties of
the object in the application change dynamically. For example text of a link in a webpage is the
username used to login to that page.
Text property is used by test object to identify the link. So in order to identify the actual object we
can manipulate the value of “text” property of link using SetTOProperty.

This can be used for existing Dynamic Objects in OR.

( c)
By Using Object Repository Automation Model.
You can use ObjectRepositoryUtil Object and apply Add Object Method.
For more info, please check QTP Help.
By using this: you can add objects to OR from your script


RE: How to add an object to repository through script - kp.naravi - 06-12-2008

Hi Niranjan


Thanks for your help, i will go with last method i.e. using ObjectRepositoryUtil Object and apply Add Object Method.


Thanks for your help,
KP