how do you remove object repository at runtime and load
object repository and verify it
Answers were Sorted based on User's Feedback
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 |
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 |
what are SetToProperty, SetROProperty,GetToproperty scripting?
I have written a code to fetch values fro access db and place in the fields. Iam using GetROProperty to fetch runtime values. Now i want to add runtime values to the access db in field v3. please help me. Its not writting in the db. Option explicit Dim con,rs,db,c Set con=createobject("adodb.connection") Set rs=createobject("adodb.recordset") con.Open "Driver={Microsoft Access Driver (*.mdb)};dbq=D:\Sales.mdb" rs.open "select * from tax",con Do while not rs.eof Browser("Sales Tax Calculator").Page("Sales Tax Calculator").WebEdit("incost").Set rs.fields("v1") Browser("Sales Tax Calculator").Page("Sales Tax Calculator").WebEdit("intax").Set rs.fields("v2") c=Browser("Sales Tax Calculator").Page("Sales Tax Calculator").WebEdit("outtax").GetROProperty("value") rs.MoveNext print c Loop Do while not rs.EOF rs.EditMode rs.Fields("v3").Value="3" rs.Update rs.MoveNext Loop Set rs=nothing Set con=nothing
what are the drawbacks for record and payback in qtp
I want to write some certification courses, so friends could you guide me? which certification is best and how to write exam and what tutorials need to be studied,what to do first, I am working on automation tool QTP 9.2
How to parameterize in QTP?
If you are using descriptive programming and you have two objects with the same name, so you are identiying them by name and index, how can you avoid errors if a third object with the same name is added at the begining of the page?
Question:how many types of repositories in QTP9.2?and explain??
I am Facing Issues with learing datepicker 1)when i first learn datepicker as current system date . 2)if i wanna runtime datepicker value it gives error
How do u fetch data from a database ?
Hi, OUR PROJECT NAME IS: HOSPITAL CONTROL SYSTEM. IS IT COMES UNDER WHICH DOMAIN(HEALTH CARE OR HEALTH INSURANCE)
Set DR= CreateObject("Mercury.DeviceReplay")
Did QTP prove efficient for your project? Yes or No, explain?