Micro Focus QTP (UFT) Forums
How to get rid of this error in QTP? - 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: How to get rid of this error in QTP? (/Thread-How-to-get-rid-of-this-error-in-QTP)



How to get rid of this error in QTP? - DrasticDreamer - 12-18-2015

I am new to QTP and trying to resolve the error. I have used the dynamic method of Descriptive programming. When running the below code I get this error:
"The "[ WebButton ]" object's description matches more than one of the objects currently displayed in your application. Add additional properties to the object description in order to uniquely identify the object."
Code:
My script is:

Set oDesc=Description.Create()
oDesc("title").value="Google"
Set oDesc1=Description.Create()
oDesc1("name").value="q"
Set oDesc2=Description.Create()
oDesc2("html tag").value="INPUT"
oDesc2("height").value="30"
oDesc2("index:").value="0"

Browser(oDesc).page(oDesc).WebEdit(oDesc1).Set 10
Browser(oDesc).page(oDesc).WebButton(oDesc2).Click
I have used "index" property in order for QTP to uniquely identify the object.

Please help.


RE: How to get rid of this error in QTP? - SRP - 12-18-2015

instead of:
oDesc2("height").value="30"
try WebButton("value:=Submit").Click

where "Submit" is the text on the button
using your format my example would be
oDesc2("value").value="Submit"


RE: How to get rid of this error in QTP? - vinod123 - 12-18-2015

Code:
Set oDesc=Description.Create()
oDesc("title").value="Google"
Set oDesc1=Description.Create()
oDesc1("name").value="q"
Set oDesc2=Description.Create()
oDesc2("html tag").value="Submit"
oDesc2("height").value="30"
oDesc2("index:").value="0"



RE: How to get rid of this error in QTP? - DrasticDreamer - 12-18-2015

Thank you. I will try your format too.

I tried this:

Browser(oDesc).page(oDesc).WebButton(oDesc2,"index:0").Click

This is working for me now.