I`m using WebAii 2.0 (VS 2009, C#) for automation testing Silverlight web application. There is RadGridView element with 15 rows, but just 7 of them are fited in visible area of RadGridView. To see others I need to turn mouse wheel.
If I use:
app.FindName<RadGridView>("grdPermissions").User.TurnMouseWheel(10, ArtOfTest.WebAii.Core.MouseWheelTurnDirection.Forward, false);//(or true)
I see how whole page moves into broeser tab(IE8).
1) How can I scroll just radGridView content?
2) Can I get all rows in radGridView (all 15 rows, not just 7 visible rows)?
Regards,
Kir
developer
7 Answers, 1 is accepted
1. In order to scroll only the radgridview content you can try to:
- Find the gridview's scrollbar, like this:
var grid = app.FindName<RadGridView>("RadGridView"); ArtOfTest.WebAii.Silverlight.UI.ScrollBar verticalscrollbar = gridView.Find.ByName<ArtOfTest.WebAii.Silverlight.UI.ScrollBar>("PART_VerticalScrollBar"); verticalscrollbar.User.TurnMouseWheel(10, MouseWheelTurnDirection.Forward, true);2. Regarding your second question :
Unfortunately it is not possible to get all GridViewRows because our grid uses virtualization techniques and only just a fraction of all rows are available at any time.
If you put the grid inside StackPanel or ScrollViewer there will be no rows virtualization - the grid will be measured with infinity Height and will try to create all rows, so you will be able to get all rows.
Unfortunately that approach can cause serious performance problems if you have a grid with large amount of rows - since RadGridView will try to create all the rows.
If you have any other questions , please do not hesitate to write back to us.
Regards,
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Thank you Anastasia for your clear response.
And now I have some other questions:
1) I can`t find how can I check is the element(for example HyperlinkButton, RadGridView or TextBox) enabled?
How can I get this element`s property?
2) If silverlight-developer uses his owen developed elements (dll is attached to project references), can I manage this element?
like this: app.FindName<SomeElement>("someElement").User.Click();
where SomeElement is class described in dll (attached to project references).
Regards,
Kir
developer
Elements like HyperlinkButton and TextBox have the respective IsEnabled property that you can use for the described purpose.
We will look into exposing that same property for RadGridView as well. Please stay tuned for the next update of the framework.
As to your second question, you will need to define your own wrapper control extending from one of the elements in ArtOfTest.WebAii.Silverlight.UI like FrameworkElement. You should build your WebAii control assembly adding references to ArtOfTest.Common and ArtOfTest.WebAii assemblies. Next, in your test project you can add reference to your WebAii control assembly and you are ready to go.
Let us know if further questions arise.
Regards,
Konstantin Petkov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
I hope the next update is not far off :)
My question again:
how to get control element tooltip to check its textcontent (it appears when I hover the mouse over TextBlock)?
And one remark:
app.Find.ByText(_RadGridViewCellTextContent).User.Click(MouseClickType.LeftDoubleClick) - doesn`t work as doubleclick.
Silverlight application which I`m testing have to perform certain actions on doubleclick, but this doesn`t happen. Just selected cell goes into edit mode like after click + click.
Is it possible to change time delay between clicks? Or some other or another way?
Regards,
Kir
developer
The next framework update is coming in two weeks with the major Q3 release and WebUI Test Studio v2.0 BETA.
As to the tooltip, it depends on whether the tooltip in question is attached to the visual tree. If so you should be able to find it looking for the only popup element. If it is not part of the visual tree in Silverlight though, I'm afraid you can't find it currently.
The mouse clicks success heavily depends on the actual point you click on. For example with a couple of our RadControls we need to click at a point with some offset within the element to succeed. That's why we improve the WebAii RadControls API exposing some helpful methods.
I'm posting below a sample RadGridView test deleting a row and using the GridViewRow.MouseClick() method. Please note the second argument is exactly the offset with click with in order to succeed. This might be exactly what you are looking for:
public void DeleteSelectedRow(){ LaunchInitialize("/TestPage.aspx#GridView/DataSourceUpdates", "radGridViewDataSourceUpdates"); int initialRowCount = gridView.Rows.Count; gridView.Rows[0].MouseClick(MouseClickType.LeftDoubleClick, 20, 2); // click the demo 'delete' button to delete the grid view selected row app.Find.ByName("deleteCurrentRecord").User.Click(); gridView.Refresh(); Assert.AreEqual(gridView.Rows.Count, initialRowCount - 1);}Kind regards,
Konstantin Petkov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Thank you for your answer, but incorrect response to double-click on the cell of the
RadGridView is preserved.And another question:
when I click on button in Silverlight application that I'm testing, the browser opens HTML-page in new window. Is it possible to control this page: enter text, press buttons and then check results?
Regards,
Kir
developer
For connecting to a popup browser window launched by your Silverlight app, you should be able to use:
Manager.WaitForNewBrowserConnect("launched popup url", true, 5000);
Manager.ActiveBrowser.WaitUntilReady();
It may help to enable annotation to view to where the mouse click is happening for your RadGridView where you can set this as follows in your settings:
settings.AnnotateExecution = true;
settings.AnnotationMode = AnnotationMode.All;
And you can try to use the framework to figure out where to click as in:
Rows[0].User.Click(
MouseClickType.LeftDoubleClick, g.Rows[0].GetRectangle().X, g.Rows[0].GetRectangle().Y,ArtOfTest.Common.OffsetReference.AbsoluteCenter);
or
Rows[0].User.Click(
MouseClickType.LeftDoubleClick, g.Rows[0].GetScreenRectangle().X, g.Rows[0].GetScreenRectangle().Y,ArtOfTest.Common.OffsetReference.AbsoluteCenter);
Or any of the properties of the rectangles and the OffsetReference enum to get the double click working. Please let us know if the double click works with any of the above
Hoper that helps,
Nelson Sin
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.