Unable to get SlvTable column name correctly for a particular scenario (341 Views)
Reply
Occasional Advisor
NaveenVanapalli
Posts: 9
Registered: ‎12-04-2013
Message 1 of 5 (341 Views)

Unable to get SlvTable column name correctly for a particular scenario

Hello,

 

I have a silverlight table in AUT, where i am unable to get the column names correctly using the below code.

 

QTP Code:

Set objColHeader = Browser("Browser").Page("Page").SlvWindow("Window").SlvTable("Table").Object.Columns
rcHeaderCount = objColHeader.Count
Msgbox rcHeaderCount
For i = 1 To rcHeaderCount
            colName = objColHeader.Item(i).Header
            Msgbox "Column Name ("& i &") -- '"& colName &"'"
            Print "Column Name ("& i &") -- '"& colName &"'"
Next

 

SilverTable contains:

Rows - 1

Columns -10

Note: In the silverlight table, 2nd column contains a checkbox and two buttons and the 1st and remnaing columns has names

 

Please see the attached screenshot.

 

Actually when i am executing the abvoe code, QTP is returning the column names as follows:

1st Column name as - #

2nd Column name as - APN -- this should be return in 3rd iteration

3rd Column name as - Owner Names -- this should be return in 4th iteration

.

.

.

So on....

 

Coluld some one help me in getting the column names correctly according to the FOR loop iterations?

Moreover, i am using QTP 11.0 and Silverlight version 5.1.20913.0 in our AUT.

 

Thanks,

Naveen

Please use plain text.
Occasional Advisor
NaveenVanapalli
Posts: 9
Registered: ‎12-04-2013
Message 2 of 5 (338 Views)

Re: Unable to get SlvTable column name correctly for a particular scenario

Hello,

 

I forgot to mention in the below post that i even tried in different ways to get the column names using SlvTable mehtods and properties in the QTP help file but no luck.

 

Observed that when i am using obj.GetCellData(row, column), i need to pass the argumnets as row-0 and column-0 to get the 1st row and 1st column of data rows and nowhere QTP help suggest the users to use something to get the column names of SlvTable.

 

Thanks,

Naveen

Please use plain text.
HP Expert
Ana_Noncheva
Posts: 245
Registered: ‎08-06-2013
Message 3 of 5 (316 Views)

Re: Unable to get SlvTable column name correctly for a particular scenario

Hello Naveen,

 

How many iterations are made in above example? What is exact output (from Print method)?

Please note that here you are using internal Silverlight DataGrid methods and properties. I.e. they are not supported by QTP.

 

So what is the output when iteration with with SlvTable.GetCellData(r, c), when "r" is 0 (the row), and "c" is "i" (the column)?

 

Regards,

Ana

“HP Support
If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.”
Please use plain text.
Occasional Advisor
NaveenVanapalli
Posts: 9
Registered: ‎12-04-2013
Message 4 of 5 (306 Views)

Re: Unable to get SlvTable column name correctly for a particular scenario

Hello Ana,

 

Thanks for your comments.

 

Total 10 iterations are made and the output (print log) for the above code is pasted below:

Column Name (0) -- '#'
Column Name (1) -- '#'
Column Name (2) -- 'APN'
Column Name (3) -- 'Owner Names'
Column Name (4) -- '#'
Column Name (5) -- 'Street'
Column Name (6) -- 'City'
Column Name (7) -- 'County'
Column Name (8) -- 'St'
Column Name (9) -- 'Link'

 

The output (print log) for the SlvTable.GetCellData(r,c):

iColCount: 10
Data (0) -- '1'
Data (1) -- '0'
Data (2) -- '12345'
Data (3) -- 'xxxxxxxxxxxxxx'
Data (4) -- '123'
Data (5) -- 'Down town'
Data (6) -- 'Anaheim'
Data (7) -- 'Orange'
Data (8) -- 'CA'
Data (9) -- 'Order'

 

Where the obj.GetCellData is retuning only data rows where i also need to get the column names for SlvTable object.

 

Could you please let me know, what you exactly mean for this sentence "Please note that here you are using internal Silverlight DataGrid methods and properties. I.e. they are not supported by QTP."

 

Regards,

Naveen

Please use plain text.
HP Expert
Ana_Noncheva
Posts: 245
Registered: ‎08-06-2013
Message 5 of 5 (293 Views)

Re: Unable to get SlvTable column name correctly for a particular scenario

Hello Naveen,

 

Given your print output and comparing it to the table screenshot, I cannot see the problem you report.

I mean, there is the correct number of iterations and order of output.

 

In short, by "internal Silverlight DataGrid properties and methods" I mean every method and property you access with the help of .Object property, like ..SlvTable.Object.Columns;

Object.Columns.Count

Object.Columns.Item(i).Header

etc.

Those are all not implemented and therefore not supported by QTP/UFT as opposed to ..SlvTable.GetCellData, for example, which is implemented by QTP/UFT and based on the control's internal methods and properties.

For a QTP/UFT test object's properties and methods you check in QTP/UFT help > Object Model Reference;

For a control's internal properties and methods you check in corresponding technology's API reference. For example, the SlvTable test object represents the Silverlight DataGrid class, whose properties and methods you can find here: http://msdn.microsoft.com/en-us/library/system.windows.controls.datagrid(v=vs.95).aspx

 

Regards,

Ana

 

 

 

 

“HP Support
If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.”
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation