Micro Focus QTP (UFT) Forums
"Object not found in OR" error while I am creating a runtime object - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: "Object not found in OR" error while I am creating a runtime object (/Thread-Object-not-found-in-OR-error-while-I-am-creating-a-runtime-object)



"Object not found in OR" error while I am creating a runtime object - reejais - 10-08-2010

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.


RE: "Object not found in OR" error while I am creating a runtime object - KavitaPriyaCR - 10-08-2010

Add below line while creating the description, before step5
Code:
EditDesc("micclass").value = "Link"



RE: "Object not found in OR" error while I am creating a runtime object - reejais - 10-08-2010

Hi Kavita,

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

Regards,
Reema.


RE: "Object not found in OR" error while I am creating a runtime object - KavitaPriyaCR - 10-08-2010

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


RE: "Object not found in OR" error while I am creating a runtime object - quicktest - 10-08-2010

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 ....


RE: "Object not found in OR" error while I am creating a runtime object - KavitaPriyaCR - 10-08-2010

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"


RE: "Object not found in OR" error while I am creating a runtime object - cdesserich - 10-08-2010

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)



RE: "Object not found in OR" error while I am creating a runtime object - reejais - 10-11-2010

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


RE: "Object not found in OR" error while I am creating a runtime object - KavitaPriyaCR - 10-11-2010

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.


RE: "Object not found in OR" error while I am creating a runtime object - cdesserich - 10-11-2010

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.