Hi Team,
I'm trying to automate silverlight application using Telerik testing framework . I've explored and created a sample scenario on silverlight application and executed perfectly on Internet Explorer but not in Firefox (version 40.0)
While I'm executing the same script its navigating to application and throws runtime error "Timeout trying to connect to silverlight application" here "SilverlightApp app = ActiveBrowser.SilverlightApps()[0];"
I've done the workaround on the issue and found following solutions but unfortunately couldn't able solve my problem
1. Cleared the Firefox browser cache
2. added hardcoded sleeps, waits, refreshDOM and waituntilready
3.added Settings.Current.Web.EnableSilverlight = true; before launching the browser
Below is my code
[Test]
public void SilverlightCRM()
{
Settings.Current.Web.EnableSilverlight = true;
Manager.LaunchNewBrowser(BrowserType.FireFox);
ActiveBrowser.NavigateTo("http://demos.telerik.com/silverlight/crm/");
ActiveBrowser.WaitUntilReady();
ActiveBrowser.RefreshDomTree();
System.Threading.Thread.Sleep(50000);
SilverlightApp app = ActiveBrowser.SilverlightApps()[0];
ActiveBrowser.WaitUntilReady();
ActiveBrowser.Window.Maximize();
//app.Find.ByTextContent("companies").Wait.ForExists();
// app.Find.ByTextContent("companies").User.Click();
System.Threading.Thread.Sleep(5000);
ActiveBrowser.RefreshDomTree();
ActiveBrowser.WaitUntilReady();
app.Find.ByExpression(new XamlFindExpression("XamlTag=contentcontrol","name=MainMenuRegionPlaceholder","|",
"XamlPath=/contentpresenter[0]/mainmenuview[0]/grid[name=LayoutRoot]/stackpanel[0]/radradiobutton[1]")).User.Click(); //click on company
ActiveBrowser.WaitUntilReady();
System.Threading.Thread.Sleep(50000);
app.Find.ByAutomationId("AddNew").Wait.ForExists();
System.Threading.Thread.Sleep(5000);
//app.Find.ByExpression(new XamlFindExpression("XamlTag = radbutton", "AutomationId = AddNew")).Wait.ForVisible();
// app.Find.ByExpression(new XamlFindExpression("XamlTag = radbutton", "AutomationId = AddNew")).User.Click() ; //click on ADD
// app.Find.ByAutomationId("AddNew").User.Click(); //Click on ADD
System.Threading.Thread.Sleep(5000);
// app.Find.ByName("PART_FieldsContentPresenter").User.Click(); //enter text in description field
// app.Find.ByName("PART_FieldsContentPresenter").User.TypeText("telerik",10);
//app.Find.ByExpression(new XamlFindExpression("XamlTag=contentpresenter", "name=PART_FieldsContentPresenter1", "|", "XamlTag=TextBoxView")).User.Click(); //click on field
// app.Find.ByExpression(new XamlFindExpression("XamlTag=contentpresenter", "name=PART_FieldsContentPresenter1",
// "|", "XamlTag=TextBox")).User.TypeText("srkjasdn", 10); //enter text in field
app.Find.ByName("ContentElement").User.Click(); //click on compnay field
app.Find.ByName("ContentElement").User.TypeText("telerik", 10); //enter text in company field
}
Please let me know if there is any other way to resolve this issue or am I need to add anything else , Thanks in advance
Regards,
Deepak.