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

Find.AllByType<RadBusyIndicator>()?

6 Answers 122 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 22 Nov 2011, 04:05 AM
I'd like to use app.Find.AllByType<RadBusyIndicator>(). I know RadBusyIndicator is not a FrameworkElement. Is this possible?

Let me know if you need more details. Thanks.

6 Answers, 1 is accepted

Sort by
0
Stoich
Telerik team
answered on 24 Nov 2011, 03:56 PM
Hello Jon,
you'll have to use Find.AllByExpression(new XamlFindExpression("XamlTag=radbusyindicator")) instead. Blow is a code sample that demonstrates this approach against this demo page:
http://demos.telerik.com/silverlight/#BusyIndicator/FirstLook

You might have to add a System.Threading.Thread.Sleep() wait step after the navigateTo step. This is because it take a while for the entire DOM tree of the app to properly load.

Settings.Current.Web.EnableSilverlight = true;
// Launch a browser instance
Manager.LaunchNewBrowser();
  
// Navigate to the page
ActiveBrowser.NavigateTo("http://demos.telerik.com/silverlight/#BusyIndicator/FirstLook");
 
// Get an instance of our Silverlight app.
SilverlightApp app = ActiveBrowser.SilverlightApps()[0];
  
//Go through all the busyIndicators and write their string representation to the log
foreach (FrameworkElement fe in app.Find.AllByExpression(new XamlFindExpression("XamlTag=radbusyindicator"))) {
   Log.WriteLine(fe.ToString());
}


All the best,
Stoich
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
N1t1nA
Top achievements
Rank 1
answered on 20 Nov 2012, 11:40 AM
Hi Support

How should i typecast my framework Element as BusyIndicator as I want to use the Busy indicator property IsBusy in my framework for Verification

My code is :
var list = SilverlightApp.Find.AllByType("BusyIndicator");

from this list obtained above, i want to fetch the busyindicator object to access the IsBusy property so that I can perform my logic based on this property.


Regards
Nitin



0
Stoich
Telerik team
answered on 22 Nov 2012, 02:58 PM
Hi Jon,
you can do it like this:
FrameworkElement e = ActiveBrowser.SilverlightApps()[0].Find.AllByExpression(new XamlFindExpression("xamltag=RadBusyIndicator"))[0];
RadBusyIndicator b = e.As<RadBusyIndicator>();

The b variable will now of class RadBusyIndicator. I hope this help.

All the best,
Stoich
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Rohit
Top achievements
Rank 2
answered on 23 Nov 2012, 08:55 AM
Hi Stoich,

In our Application we are using the System.Windows.Controls busy Indicator So we need to convert it into:-

FrameworkElement e = ActiveBrowser.SilverlightApps()[0].Find.AllByExpression(new XamlFindExpression("xamltag=BusyIndicator "))[0];
BusyIndicator b = e.As<BusyIndicator >();

It is using the dll.
using System.Windows.Controls;


RadBusyIndicator we are not using so the solution you have provided is not useful for us.

Any alternate or work around please provide.

Please Reply fast Because it very Important to us

Regards,
Rohit Malhotra
0
Stoich
Telerik team
answered on 23 Nov 2012, 03:10 PM
Hello Jon,
I understand now.

We have no wrapped for this control. This means you should try and get the intended property using GetProperty as seen here:
http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/write-tests-in-code/silverlight-test-automation/invoking-actions.aspx

The code will be something like this:
FrameworkElement indic = app.FindName("airlineTicket");
AutomationProperty busystatus = new AutomationProperty("isBusy", typeof(bool));
 
bool iBusy= (bool)indic.GetProperty(busystatus);

I hope this helps.

Kind regards,
Stoich
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Stanislav
Top achievements
Rank 1
answered on 26 Nov 2012, 06:47 AM
Jon,

You can develop your own wrappers for custom controls in the application. I have many custom controls in my product and I was forced to create all wrappers manually. Fortunately, Telerik testing framework provides such capabilities (the most flexible framework for WPF automation that I have ever seen).

Let me know if you need any advice or a piece of code.

Kind Regards,
Stanislav Hordiyenko
Tags
General Discussions
Asked by
Jon
Top achievements
Rank 1
Answers by
Stoich
Telerik team
N1t1nA
Top achievements
Rank 1
Rohit
Top achievements
Rank 2
Stanislav
Top achievements
Rank 1
Share this question
or