2015-12-17 42 views
0

我是QTP的新手,並試圖解決此錯誤。我使用了描述性編程的動態方法。當運行下面的代碼我得到這個錯誤:如何擺脫QTP中的這個錯誤?

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

我的腳本是:

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 

我曾用「指數」的屬性,以便QTP唯一地標識對象。請幫忙。

+1

可以嘗試刪除冒號「:」索引屬性後, 使其oDesc2(「指數」)值=「0」並檢查 – user5612655

回答

0

應該

oDesc2("index").value="0" 

,而不是

oDesc2("index:").value="0" 

您已經包括額外的冒號()在你的屬性名稱。對象屬性名稱是「指數」你已經給「指數: