Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Handling Object Repositories dynamically inside For Loop
#1
Not Solved
Dim obj_rep, obj_col, repository_no, obj_count
Code:
For repository_no = 1 to 10

Set obj_rep = CreateObject("Mercury.ObjectRepositoryUtil")
obj_rep.Load "E:\QTP\user_registration.tsr"

Set obj_col = obj_rep.GetAllObjects()
obj_count = obj_col.Count
Print obj_count

Set obj_col = Nothing
Set obj_rep = Nothing

Next


When I run the above script, only once the obj_count is getting printed. The obj_count for remaining 9 repositories are not printed.
How to overcome this?
Reply
#2
Not Solved
Hi,

Do u want to load 10 different repositories???? If yes, then change the line
obj_rep.Load "E:\QTP\user_registration.tsr" becuase every time this will load the same OR.

Regards,
Sankalp
Reply
#3
Not Solved
Code:
Dim obj_rep, obj_col, repository_no, obj_count

For repository_no = 1 to 10

Set obj_rep = CreateObject("Mercury.ObjectRepositoryUtil")
obj_rep.Load obj_repository_file_path & current_screen & ".tsr"

Set obj_col = obj_rep.GetAllObjects()
obj_count = obj_col.Count
Print obj_count

Set obj_col = Nothing
Set obj_rep = Nothing

Next


When I run the above script, only once the obj_count is getting printed. The obj_count for remaining 9 repositories are not printed.
How to overcome this?

obj_repository_file_path - would be taken from environment file.
current_screen - would be taken from the OR folder at run time based on a condition.
Reply
#4
Not Solved
Dim obj_rep, obj_col, repository_no, obj_count

For repository_no = 1 to 10

Set obj_rep = CreateObject("Mercury.ObjectRepositoryUtil")
obj_rep.Load obj_repository_file_path & current_screen & ".tsr"

Set obj_col = obj_rep.GetAllObjects()
obj_count = obj_col.Count
Print obj_count

Set obj_col = Nothing
Set obj_rep = Nothing

Next


When I run the above script, only once the obj_count is getting printed. The obj_count for remaining 9 repositories are not printed.
How to overcome this?

obj_repository_file_path - would be taken from environment file.
current_screen - would be taken from the OR folder at run time based on a condition.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Difference between error handling and exception handling venkatbatchu 6 26,588 12-11-2018, 05:11 PM
Last Post: smitapawar610
  SAPLIST is not recognised inside SAPTable mann 0 1,246 02-26-2018, 11:24 AM
Last Post: mann
  UFT - Check a checkbox inside a table cell sara- 0 5,706 02-02-2015, 08:07 PM
Last Post: sara-
  Declaring Extern in QTP to call a DDE function inside a DLL **SOLVED** ramuk 1 3,439 06-07-2012, 07:57 PM
Last Post: ramuk
Exclamation Objects inside Pop up window not recognised. falvi 12 10,680 04-12-2012, 11:26 AM
Last Post: falvi

Forum Jump:


Users browsing this thread: 1 Guest(s)