This is a migrated thread and some comments may be shown as answers.

Not Able to retrieve numbe rof columns from a Table.

5 Answers 131 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
aadi kumar
Top achievements
Rank 1
aadi kumar asked on 18 May 2010, 10:26 AM

Hi

I am trying to count number of columns and column values from a table but everytime I am getting wrong values.

Please check below for the Object Property:

Object Property

<table rules="all" cellspacing="0" cellpadding="3" border="1" style="border-collapse: collapse;" columncount="10" expandedclientidsname="HierarGrid_ExpandedIDs_ResultsGrid_ctl06" class="Datagrid">

Code:
Dim t As HtmlTable = myManager.ActiveBrowser.Find.ByExpression(Of HtmlTable)("class=Datagrid")

 

 

Dim Rowcounts As Integer = t.Rows.Count              

 

 

Dim ColumnCount As Integer = t.ColumnCount()

 

 

Row Count is working properly but Column Count is not working properly.

I am using above code to find the number of columns but instead of returning 10 it is returning 2. So please tell me the solution.
Do let me know if I am doing anything wrong.         

5 Answers, 1 is accepted

Sort by
0
Missing User
answered on 18 May 2010, 11:30 PM
Hi aadi,

Thanks for the post and question, and your trial of WebUI Test Studio.

From what I've researched on WC3's site and after talking to my boss, the 'columncount' attribute typically is not associated with the table tag or table element.

I ran a reproduction with the html and test code you posted in each of the supported browsers, and all of them interpreted the code the same and returned the came column number of 2, even with columncount = 10.

Was this attribute generated via a RadControl implementation or some other type Ajax html code generation?

Regards,
Nelson
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
aadi kumar
Top achievements
Rank 1
answered on 19 May 2010, 06:52 AM
Thanks for your reply. as par my knowledge  Dev team is using "Ajax html code"  to generate the properties.
So do let me know if any workaround is there to resolve this issue.

~Thanks
0
Missing User
answered on 19 May 2010, 09:17 PM
Hello again aadi,

So there really isn't a work around for this as that property is only populated by what the playback brower reports from it's translation of the html.

If you wanted to check for that attribute, you can access it via:

Dim a As iAttribute = t.Attributes(5)


Best wishes,
Nelson
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
aadi kumar
Top achievements
Rank 1
answered on 20 May 2010, 05:55 AM
Thanks for your reply.
Incase of RadControl implementation ,what could be the workaround?

Some of the features of our application has 'RadControl implementation '.


~Thanks
Ajit Kumar
0
Accepted
Missing User
answered on 21 May 2010, 11:36 PM
Hi again aadi/ajit,

So a GridTableView/HtmlTable is the same implementation and you'll get the same column count as the code you posted. Here is a coded example where the code will return 6 as expected for the demo page:
 
<TestMethod()> _
     Public Sub SampleWebAiiTestVB()
         ' Launch a browser instance
         Manager.LaunchNewBrowser(BrowserType.InternetExplorer)
         ' The active browser
         ' Find the google search box and set it to "ArtOfTest";
         Dim n As Integer = Find.ByExpression(Of HtmlTable)("id=RadGrid1_ctl00", "tagname=table").ColumnCount
     End Sub

Sincerely,
Nelson
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
General Discussions
Asked by
aadi kumar
Top achievements
Rank 1
Answers by
Missing User
aadi kumar
Top achievements
Rank 1
Share this question
or