Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
object's description matches more than one
#1
Solved: 11 Years, 3 Months ago
Hi all,

I have a web Element in my application which is getting reated in diffrent positions.

I want to capture the value of that element ....here is my code

Code:
B=Browser("name:=.*").Page("title:=.*").WebElement("html tag:=B","height:=14").GetROProperty("innertext")

but it gives a error saying

"[ WebElement ]" 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.

which is obivious bcoz the same web element is dispalyed at diffrent positions.

My question is ......

how can i select any 1 of them?



Thanks
sia
Reply
#2
Solved: 11 Years, 3 Months ago
try using index property.
Reply
#3
Solved: 11 Years, 3 Months ago
try index property as mentioned by 'ankesh' below is the code.

Code:
B=Browser("name:=.*").Page("title:=.*").WebElement("html tag:=B","height:=14" , "index:=0").GetROProperty("innertext")


Thanks,
Harish
Reply
#4
Solved: 11 Years, 3 Months ago
Code:
B=Browser("name:=.*").Page("title:=.*").WebElement("html tag:=B","height:=14" , "index:=0").exists

B=Browser("name:=.*").Page("title:=.*").WebElement("html tag:=B","height:=14" , "index:=1").exists

B=Browser("name:=.*").Page("title:=.*").WebElement("html tag:=B","height:=14" , "index:=2").exists

B=Browser("name:=.*").Page("title:=.*").WebElement("html tag:=B","height:=14" , "index:=3").exists

B=Browser("name:=.*").Page("title:=.*").WebElement("html tag:=B","height:=14" , "index:=4").exists


can i use loop instead of this if yes how?
Reply
#5
Solved: 11 Years, 3 Months ago
below is the sample code.

Code:
for i=0 to 5
Browser("name:=.*").Page("title:=.*").WebElement("html tag:=B","height:=14" , "index:="&i)
Next

Regards,
Ankesh
Reply
#6
Solved: 11 Years, 3 Months ago
what if the 5 no is not fixed ....its varieng every time ?
for i=0 to 5(diffrent for every run)?
Reply
#7
Solved: 11 Years, 3 Months ago
Use child obejcts to get the total count and then loop it.

i have given a sample code to you. You need to edit it.
Reply
#8
Solved: 11 Years, 3 Months ago
Please note to check the existance of any object you should use Exist.

Code:
If Browser(...).Page(...).Link(...).exist Then
'''
End IF
Your bwlow code will not work as you are just specifying the index,
Code:
Browser("name:=.*").Page("title:=.*").Link("index:="&x)

You should use the below code instead.
Code:
if Browser("name:=.*").Page("title:=.*").Link("html tag:=A","text:=Rate this","index:="&x).Exist Then
'do your task
End IF

Regards,
Ankesh
Reply
#9
Solved: 11 Years, 3 Months ago
Reporter event syntax is wrong.

It should be,

Code:
Reporter.ReportEvent micPass,"Chk link existance","Link Exist".

try and see.

Regards,
Ankesh
Reply
#10
Solved: 11 Years, 3 Months ago
GR8 .......IT worked ....

Thank you so Much Smile
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Taking Property values in Description objet throw Excel Sheet devarapallliramana 3 3,099 03-11-2014, 10:50 PM
Last Post: supputuri
  error with msdn's description of overwrite value of CreateTextFile ?? anu05446 1 2,577 03-10-2014, 02:48 PM
Last Post: basanth27
  Description about Types of Ordinal Identifier abhijit.airforce 1 2,472 12-27-2013, 02:57 PM
Last Post: Ankesh
  WebElementobject's description matches more than one of the objects sumanth 5 3,859 10-29-2013, 03:15 PM
Last Post: Sathiya
Sad Empty Server description SAP GUI 7.20 with QTP11 sylvester618 2 4,681 09-10-2013, 06:05 PM
Last Post: Ankur

Forum Jump:


Users browsing this thread: 2 Guest(s)