Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Count number of WebElement with certain property
#1
Solved: 10 Years, 8 Months, 4 Weeks ago
Hello,
I have this piece of code with different index values for WebElement("class:=errmsg errmsgDetails").

[i]
Code:
Dim errormsg1
Set errormsg1=Browser("IHG").Page("Home").WebElement("class:=errmsg errmsgDetails")

If  errormsg1.Exist Then
    msg=errormsg1.GetROProperty("innertext")
    msgbox(msg)
End If
[/i]


How do I capture elements with same property on the screen and then would like to run a loop to capture inner text.

For example rightnow in this case there are two occurences when I add index:=0 or index:=1 I , the getROProperty part works fine.
Reply
#2
Solved: 10 Years, 8 Months, 4 Weeks ago
Hi,
to get the count

Code:
Set myElement = Description.Create
myElement("micclass").value = "WebElement"
myElement("class").Value = "errmsg errmsgDetails"
msgbox Browser("IHG").Page("Home").ChildObjects(myElement).Count

below statement will return all the webelements with the properties. it s a collection. so u can loop to get the property values for each object[/code]
Code:
Browser("IHG").Page("Home").ChildObjects(myElement)

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to count no of Webelement in a WebTable? Akhila 1 4,127 10-11-2013, 06:00 PM
Last Post: Parke
  to count the number of used rows in a particular column sujaravi123 3 10,912 06-12-2013, 03:17 PM
Last Post: sujaravi123
  How to count a repeated number in number in particular range gollsrin 1 3,414 04-28-2011, 11:41 AM
Last Post: Saket
  Count number of specific elements on a web page janriis 7 10,351 09-28-2010, 01:04 PM
Last Post: MVChowdary
  Script to count the number of mails in a given folder in Outlook Sudhamshu 2 3,542 10-12-2009, 07:57 PM
Last Post: Sudhamshu

Forum Jump:


Users browsing this thread: 1 Guest(s)