Get identification property from object when object doesn't exist on page - 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: Get identification property from object when object doesn't exist on page (/Thread-Get-identification-property-from-object-when-object-doesn-t-exist-on-page) |
Get identification property from object when object doesn't exist on page - Dili - 03-07-2012 hi all, i'm trying to get the "name" property of an object. the object may or may not be present on the page and for my testing purposes it doesn't matter. when i try the following and the object is not present on the page i get an "Cannot identify the object...Verify that this object's properties match an object currently displayed in your application." Code: Browser("Browser").Page("Page").WebEdit("Control").GetTOProperty("name") all i need to do is get at the object's name, which is already saved inside the object repository and as i said above, i don't care if the object exists or not. i was hoping there would be a way to retrieve an object's property from its object repository without needing it to be present on the page. does anyone have a solution? thanks! RE: Get identification property from object when object doesn't exist on page - vinod123 - 03-07-2012 'The following example retrieves an object repository's objects and properties, 'looks for specific test objects using several methods, and copies a test object 'to another object repository. Code: Dim ImageObj, PageObj, RepositoryFrom, RepositoryTo 'a specified parent object. For each test object, a message box opens containing the 'test object's name, properties, and property values. Code: Dim TOCollection, TestObject, PropertiesCollection, Property, Msg Function EnumerateAllObjectsProperties(Root) 'The following function enumerates all the test objects under a specified object. 'For each test object, a message box opens containing the test object's name, 'properties, and property values. Code: Dim TOCollection, TestObject, PropertiesCollection, Property, Msg Function RenameAllImages(Root) 'The following function sets a new name for all image test objects under a specified object. Code: Dim TOCollection, TestObject, PropertiesCollection, Property Function RemoveAllLinks(Root) 'The following function recursively enumerates all the test objects under a specified object. 'It looks for all test objects of class Link and removes them from their parent objects. Code: Dim TOCollection, TestObject, PropertiesCollection, Property RE: Get identification property from object when object doesn't exist on page - Dili - 03-07-2012 hi vinod123! thanks for your solution! however, i've already tried this solution in the past on another project. qtp is terrible with object repository locks. if you load one it "locks" it and most of the time when you try and run the script again it gives a "general runtime error". even opening the repository directly in the qtp repository manager confirms it's locked. plus, there's not even a close() or release() function on the repository object. would there be a way to make qtp fallback to the object repository when using GetTOProperty() with the object doesn't exist on the page? |