how do you remove object repository at runtime and load
object repository and verify it

Answers were Sorted based on User's Feedback



how do you remove object repository at runtime and load object repository and verify it..

Answer / ravindra

'Adding Repository to an action

'*********************************************************************

Dim qtApp,qtRepositories, actName, RepPath

RepPath=".TRS File Path"

actName=Environment.Value("ActionName") 'Get Action Name

Set qtApp = CreateObject("QuickTest.Application") ' Create Application Object
Set qtRepositories = qtApp.Test.Actions(actName).ObjectRepositories ' Get Associated repositories list

If qtRepositories.Find(RepPath) = -1 Then
qtRepositories.Add RepPath, 1 ' Add the Object Repository to the current action
End If

qtApp= Nothing
qtRepositories= Nothing
'*********************************************************************
'*********************************************************************

'Remove repository from an action

Dim qtApp,qtRepositories, actName, RepPath, rPosition

RepPath=".TRS File Path"
actName=Environment.Value("ActionName") 'Get Action Name

Set qtApp = CreateObject("QuickTest.Application") ' Create Application Object
Set qtRepositories = qtApp.Test.Actions(actName).ObjectRepositories ' Get Associated repositories list

rPosition=qtRepositories.Find(RepPath) 'Find the Position of the Repository

If rPosition<>-1 then

qtRepositories.Remove rPosition ' Remove Repository From the Action

End if

qtApp= Nothing
qtRepositories= Nothing

Is This Answer Correct ?    2 Yes 0 No

how do you remove object repository at runtime and load object repository and verify it..

Answer / uday

This you can do in two ways:

Use "RepositoriesCollection" utility object and use below
methods as per your needs.
RepositoriesCollection.remove(pathOfSharedOR)
RepositoriesCollection.add(pathOfSharedOR)
RepositoriesCollection.add(pathOfSharedOR)


Another way is using AOM.
A bit of coding is needed, so i am putting high level
overview. I am just posting a pseudo code here:

create a QTPObject

Get associaterepositories by some method like
"AssociatedRepositories"
set repositories=QTPObject.AssociatedRepositories

Once you have repositories you can use below methods like
repositories.remove (path)
repositories.add(path)
repositories.find(path)

I hope that helps.

Thanks,
Uday
http://qtpftvideos.blogspot.com/

Is This Answer Correct ?    1 Yes 5 No

Post New Answer

More QTP Interview Questions

There are two tabs in the application suppose, A and B.On clicking the tab "A" one table grid will open. if u click on tab "B" Another table gride will open. Now can I do some operations on both table grids with a single table grid properties in the object repository? I have added all objects of the first table grid into the object repository Now iam checking enable/disable status of "save button" in the second table grid my code is like this val=javawindow("zseries").javabutton("save").getroproperty ("enabled") when I highlighting the save button in the object repository by keeping open the second tablegrid on the application.It is displaying the popup message"The selected object can not be found in the application" can I use properties of one table grid for both tabs if so how it is possible. Can anyone help me

2 Answers   Livetek,


If the weblist is identified as webelement,and by clicking on webelement if the values are displayed,and if the values the values also identified as webelement.then how to fetch the values through script?

0 Answers  


explain virtual object? in detailed? pls any one explain me?

4 Answers   Cap Gemini,


Hi all please solve this.It is urgent..... When I right clicked on a Web image manually It displayed Open link,open link in new window,save picture as, Email picture,Printpicture,propeties...etc. While automation I have written a code like this 'browser("Google").Page("ramseeker®: Memory and_3").Image ("graphOfModel").Click 10,10,micRightBtn But the right click menu was not displayed. I want to save that image in a seperate folder

6 Answers  


what is object spy

5 Answers   TCS,






what is test data

4 Answers   Wipro,


If requirments changed then how we can teach the QTP this is the new requirment

2 Answers   Accenture,


What is checking bitmaps?

0 Answers  


What are the features supported by UFT?

0 Answers  


Suppose there is a bitmap with some text in it how do you write the script to get the text.

2 Answers   BirlaSoft,


how to retrive that the number of spaces are in a string ????

2 Answers   Liquid Hub,


How can we count the no of rows are available in a data table ?

9 Answers   Kanbay,


Categories