objApplication =
Browser.SilverlightApps().GetApp(0);
objApplication.Connect();
DataGrid
objDataGrid =
objApplication.Find.ByName<
DataGrid
>("dataGrid");
objDataGrid.Rows[0].Cells[0].Find.ByName<
RadioButton
>().User.Click();
However when i try using the above one with the latest version (), I got warnings as the Rows are depericiated and use RowElements instead. But RowElements are not FrameworkElement type and hence i couldnt fetch the image/textbox/radio inside the Cell. It would be great if you can give a sample to fetch the above using the latest methods (upgraded).
Also if am continue using the above method (using rows), will this method be removed from the framework in later releases. Is there any harm using the depreciated methods in the latest framework if it is working fine in my cases.
Thanks in advance.
8 Answers, 1 is accepted
you can rewrite your code like this:
objApplication = Browser.SilverlightApps().GetApp(0);
objApplication.Connect();
DataGrid objDataGrid = objApplication.Find.ByName<DataGrid>(
"dataGrid"
);
objDataGrid.RowElements[0].CellElements[0].CastAs<DataGridCell>().Find.Find.ByName<RadioButton>(
"someName"
).User.Click();
One consequence is that you'll need to cast IDataGridCell to a Silverlight DataGridCell (unless you're doing WPF testing in which case you'll have to cast it to a WPF DataGridCell).
That being said I agree that the IDataGridCell interface should contain a Find method (which would have eliminated the need for casting in the above logic). I've logged this as a bug, you can track its progress here:
http://www.telerik.com/support/pits.aspx#/public/test-studio/6750
Kind regards,
Stoich
the Telerik team
Have you looked at the new Online User Guide for Telerik Test Studio?
Hi while I am using the following code in version 2011.1.609.0 it will shows the exception "object reference not set to an instance of object"
objApplication = Browser.SilverlightApps().GetApp(0);
objApplication.Connect();
RadGridView objRadGrid = objApplication.Find.ByName<
RadGridView
>("radgridview");
int i = objRadGrid.Rows.Count
Similarly I am not able to proceed with objRadGrid.Rows[5].Cells[4].text.
So I am using the following work around.
RadGridView objRadGrid = objApplication.Find.ByName<
RadGridView
>("radgridview");
GridViewRow objRows = objRadGrid.Find.AllByType<
GridViewRow
>();
int i = objRows.Count
But the above code returns only the visible rows count. I am not able to proceed for the invisible rows. objRows.ScrollToVisible() , click, etc all are not working.
Help me to proceed on this.
Thanks and Regards,
Siva
You do not need objApplication.Connect();. Rewrite your code that gets the application to this:
SilverlightApp theApp = ActiveBrowser.SilverlightApps()[0];
ScrollViewer scroller = myLB.Find.ByType<ScrollViewer>();
Cody
the Telerik team
Have you looked at the new Online User Guide for Telerik Test Studio?
I need more details about the exception you are getting. Which line of code is throwing the exception? Can you provide the complete stack trace?
Greetings,Cody
the Telerik team
Is it possible to get total number of rows (including not visible rows) in datagrid in silverlight application?
There is a property of selectedIndex of datagrid...is there a way to find out the index of a dataGridRow?
Thanks a lot.
I am sorry but we don't currently have a direct method for discovering how many rows a Silverlight DataGrid contains. The technical problem is that a DataGrid is normally bound to an "ItemsSource" object which is a collection of anything. Since we have no way of knowing what this object is, we have no method of discovering how many items are in the collection.
Maybe your developers can add a hidden field/element somewhere in the UI which contains the count you need?
If you have a GridViewRow you can get at it's index like this:
row.Index;
Cody
the Telerik team