Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"Object not found in OR" error while I am creating a runtime object
#1
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi All

My scripts looks like below

Code:
1. Set EditDesc = Description.Create()
2. EditDesc("name").value = "Edit"
3. EditDesc("text").value = "Edit"
4. EditDesc("visible").value = "True"

5. If (Browser("").Page("").Link(EditDesc).Exist then
6.    Browser("").Page("").Link(EditDesc).Click
7. else
8.    rf.writeline("User does not have permissions to edit service profile")
9. end if

I am getting an error in line 5. The error is "Object not found in object repository".

Can anybody please tell me why this error is displayed even though I am creating an object at runtime.

Thanks in advance.

Regards,
Reema.
Reply
#2
Solved: 11 Years, 3 Months, 4 Weeks ago
Add below line while creating the description, before step5
Code:
EditDesc("micclass").value = "Link"
Reply
#3
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi Kavita,

Thanks for the reply, But it is still giving me an error "EditDesc object not found in Object repository". Sad

Regards,
Reema.
Reply
#4
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi Reejais try this,
Code:
1. Set EditDesc = Description.Create()
2. EditDesc("name").value = "Edit"
3. EditDesc("text").value = "Edit"
4. EditDesc("visible").value = "True"
5. EditDesc("micclass").value = "Link"
6. Set WebEdits=Browser("").Page("").ChildObjects(EditDesc)
7. If (WebEdits(0).Exist(1)) then
8. WebEdits(0).Click
9. else
10. rf.writeline("User does not have permissions to edit service profile")
11. end if


Pls lemme know if it won't work
Reply
#5
Solved: 11 Years, 3 Months, 4 Weeks ago
If more than one object is being identified with all the properties you've used for Link, only then the error you are facing will be displayed. In simple, the properties you've used is not enough to identify the object uniquely ....
Reply
#6
Solved: 11 Years, 3 Months, 4 Weeks ago
If more than one object is being identified with all the properties we used for Link, then the error will be as "More than 1 objects matches the description....etc"
Reply
#7
Solved: 11 Years, 3 Months, 4 Weeks ago
Make sure you don't have EditDesc in quotes in your code. If it is like this:
Code:
Browser("Browser").Page("Page").Link("EditDesc")
, "EditDesc object not found in Object repository" would be the error that you would get. Make sure your code is like you wrote it here on the forum:
Code:
Browser("Browser").Page("Page").Link(EditDesc)
Reply
#8
Solved: 11 Years, 3 Months, 4 Weeks ago
Thanks cdesserich, it works now....

Kavita, actually my problem was that I was putting EditDesc in quotes. I am guessing whatever is in quotes QTP takes it as an object already present in OR and hence checks the OR. I am not sure I am just guessing .

The other way to do it is.

Code:
Browser("").Page("").Link("name:=Edit", "visible:=True").Click

This works too. Smile
Reply
#9
Solved: 11 Years, 3 Months, 4 Weeks ago
Smile
Fine if it worked Reejais. In the code which u had pasted, had no quotes...cdesserich's guessed it.
And the other way u are teling is the simplest way to do...but if the object has no much participation further in the script.
Reply
#10
Solved: 11 Years, 3 Months, 4 Weeks ago
Yes, when you hand a string argument to any of the QTP object functions, it will either assume you are calling for an Object Repository object or that you are using descriptive programming (if the string includes := to denote property/value pair). If you are handing it a variable value that is a description object, same thing, you get a descriptive programming object. The function will only recognize the description object if the variable is handed into the function directly, it will not know that your string value in quotes refers to a description object, it only sees it as a string.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Object not found during the 2nd iteration of an Action call in a For loop BGunay 0 968 04-23-2020, 07:08 PM
Last Post: BGunay
  Collecting Objects And Object State At Runtime zunebuggy 3 1,717 11-22-2017, 02:37 PM
Last Post: supputuri
  object spy not recognizing object.. pleaseeeee help Sonia Sadeque 3 3,436 12-22-2016, 02:42 PM
Last Post: ishan.mahajan@adp.com
  Intermitent "Object not visible" error erodpr 5 3,503 01-14-2016, 10:55 AM
Last Post: vinod123
  When trying to recognize the object in QTP, each object is recognized as “WinObject:S geetasarvadnya 2 3,763 10-28-2015, 12:34 PM
Last Post: vinod123

Forum Jump:


Users browsing this thread: 5 Guest(s)