Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Object Repositories
#1
Not Solved
we have OR at some location, this is not related to below test.

Now, I want to access that OR dynamically by using Script...
Reply
#2
Not Solved
Hi,
The below code works for load the OR dynamically.

Code:
Set App = CreateObject("QuickTest.Application")
App.Launch
App.Visible = True
LoadOR="C:\Documents and Settings\vmotukuri2\Desktop\Resource.tsr"
Set qtTestResources = App.Test.Settings.Resources
qtTestResources.ObjectRepositoryPath = LoadOR
qtTestResources.SetObjectRepositoryAsDefault
Set qtTestResources = Nothing
Set App=NOTHING
-------------------------------------------------
Reply
#3
Not Solved
Hello,

thank you for reply,

It is not working on QTP 9.2, can you please check it on 9.2 and modify your script...

thanks & regards
Baba Fakruddin.D
Reply
#4
Not Solved
Hi ,

Try with the below AOM scripting.( Note : Copy the below code into VBS file & execute the VBS file)

Code:
Dim qtApp
Dim qtRepositories
Dim lngPosition
Set qtApp = CreateObject("QuickTest.Application")
qtApp.Launch
qtApp.Visible = True

qtApp.Open "C:\Tests\Test1", False, False
Set qtRepositories = qtApp.Test.Actions("Login").ObjectRepositories

' Add MainApp.tsr if it's not already in the collection
If qtRepositories.Find("C:\MainApp.tsr") = -1 Then     ' If the repository cannot be found in the collection
    qtRepositories.Add "C:\MainApp.tsr", 1                ' Add the repository to the collection
End If

' If InnerWnd.tsr is moved down the list - place it back at position 1
' If there's more than one object repository and InnerWnd.tsr is in position 2

If qtRepositories.Count > 1 And qtRepositories.Item(2) = "C:\InnerWnd.tsr" Then
    qtRepositories.MoveToPos 1, 2                 ' Switch between the first two object repositories
End If

' If Debug.tsr is in the collection - remove it
lngPosition = qtRepositories.Find("C:\Debug.tsr")     ' Try finding the Debug.tsr object repository
If lngPosition <> -1 Then                                   ' If the object repository was found in the collection
    qtRepositories.Remove lngPosition ' Remove it
End If

' Set the new object repository configuration as the default for all new actions
qtRepositories.SetAsDefault      ' Set object repositories associated with the "Login" action as the default for all new actions

qtApp.Test.Save ' Save the test
qtApp.Quit ' Quit QuickTest
Set qtRepositories = Nothing ' Release the action's shared repositories collection
Set qtApp = Nothing ' Release the Application object
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)