-
Moderator
Counting objects in a web table
How to count objects in a web table ?
I used Browser(..).Page(..).WebTable(..).RowCount, but the tool kept saying that the object is not registered in Obj repository. Every time I tried to add it (web table) in my repository, it kept adding the lowest level of the tree which is an image instead of the webtable that is couple levels higher than the image.
Note : [This questions was asked by Noni]
-
Junior Member
Re: Counting objects in a web table
select the web table - one level above the lowest element will be the web table object.
-
Junior Member
Re: Counting objects in a web table
Hi,
The important thing is that what do you want to count..
What is the object type??
Is it a button,input field or number of rows or no of columns??
So basing on your requirement we can find out the objects.
As mentioned in the above reply, we can use that or we can use property "childobjects".
Please let me if i am wrong.
Thanks , Jitu
-
Junior Member
Re: Counting objects in a web table
hi,
Anybody is there who's help me
Actually i want to count the row and columns in web table and i use the rowcount for it in webtable. Infirst iteration it give the right results but in second iteration with different id then it unable to recognize the table and it shows the incorrect row count.
Thanks,
Amit
-
Junior Member
Re: Counting objects in a web table
Hi Sharan,
What is the code that you have written?could you please paste it here
Thanks,
G2
-
Junior Member
Re: Counting objects in a web table
Hi Jitendra
code here:
testData = DataTable("Path", dtGlobalSheet)
msgbox testData
systemutil.Run "http://music.qtrax.com/albumDetail.do?action=albumDetails&albumId="&testData
wait(2)
Browser("Qtrax - Home").Page("Qtrax - Album - Slumdog").WebTable("No.").Check CheckPoint("No._6")
rowcount = browser("Qtrax - Home").Page("Qtrax - Album - Slumdog").WebTable("No.").RowCount
msgbox rowcount
I tried with descriptive programming also but when i use this code it shows "General run error" Code this one for descriptive :
Set objValStore= Browser("Qtrax - Home").Page("Qtrax - Album - Slumdog")
Set objWebTableDesc=Description.Create()
objWebTableDesc ("Class Name").Value="WebTable"
set WebTableParent=objValStore.Childobjects(objWebTableDesc) //General run error here
WebTableCount=WebTableParent.count
msgbox WebTableCount
-
Junior Member
Re: Counting objects in a web table
Hi,
While recording u need to select the WebTable link rather selecting the object listed under that, then web tabel will be shown with the number of columns & rows & their contents if any.
In the code u have used pls try to make the changes below I have told, probably it may work I think,
1)find_butt = Browser("Google").Page("Google").WebTable("Advanced Search")ChildItemCount(1, 2, "WebButton")
2)msgbox find_butt
3)based on the number of buttons u get from the count, u can use that as per ur requirement like,
Browser("Google").Page("Google").WebTable("Advanced Search").ChildItem(1, 2, "WebButton", 0).Click
Browser("Google").Page("Google").WebTable("Advanced Search").ChildItem(1, 2, "WebButton", 1).Click
.....& so on
Note: this will be applicable only to the 1st row and 2nd column of the Advanced Search table
but in general if u want to count the object in the webtable then u need to create object description for the type of object u r looking inn for.
pls let me know whether it works..
thank u
lakshmi
Last edited by lakshmi_1616; 05-28-2009 at 03:20 AM.
-
Expert Member
Re: Counting objects in a web table
Hi boss,
Can u please provide the code, it can be useful.
Thanks
Bhaskar
-
Expert Member
Re: Counting objects in a web table
See below. they may be helpful.
' Get row count from a webtable
msgbox Browser("Google").Page("Google").WebTable("Advanced Search").RowCount
' Get column count from a webtable of a row
msgbox Browser("Google").Page("Google").WebTable("Advanced Search").ColumnCount(1)
Browser("Google").Page("Google").WebEdit("q").Set "qtp"
' Get unknow object.
Set myButt = Browser("Google").Page("Google").WebTable("Advanced Search").ChildItem(1, 2, "WebButton", 0)
wait(2)
myButt.click
' If there are more than on object in the column, change the last param -> replace 0 with 1 for the second object ....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules