Hi there,
I'm new to WebAii, but I was able to get some level of Silverlight automation up and running. Now, however, it appears I've hit an obstacle.
I've attached a picture of the subset of elements I'm working with. I can get a reference to the DashboardPanel element shown at the top of the image, and I can traverse the children up to the Canvas element. When debugging in Visual Studio, however, Canvas shows as having no children whatsoever. I've tried several different tactics for getting the element, but I'm confident none will work as long as Canvas supposedly has no children. Code below. Thoughts?
Thanks in advance!
Geoffrey
I'm new to WebAii, but I was able to get some level of Silverlight automation up and running. Now, however, it appears I've hit an obstacle.
I've attached a picture of the subset of elements I'm working with. I can get a reference to the DashboardPanel element shown at the top of the image, and I can traverse the children up to the Canvas element. When debugging in Visual Studio, however, Canvas shows as having no children whatsoever. I've tried several different tactics for getting the element, but I'm confident none will work as long as Canvas supposedly has no children. Code below. Thoughts?
// Initialize the settingsSettings mySettings = new Settings();Manager mgr = null;SilverlightApp app = null;try{ mySettings.Web.EnableSilverlight = true; mySettings.Web.DefaultBrowser = BrowserType.Chrome; // Create the manager object mgr = new Manager(mySettings); // Start the manager mgr.Start(); // Launch a browser instance and navigate to the page mgr.LaunchNewBrowser(); mgr.ActiveBrowser.NavigateTo("http://<;url>/"); // Initialize the Silverlight app app = mgr.ActiveBrowser.SilverlightApps()[0]; // Log into Jovix app.Find.WaitOnElementsTimeout = 20000; app.FindName<TextBox>("txtUsername").Text = "<username>"; app.FindName<PasswordBox>("txtPassword").SetPassword(true, "<password>", 0, 0); app.FindName<Button>("btnLogin").User.Click(); // Get the navigation tree control TreeView navTree = app.FindName<TreeView>("TreeView"); // Navigate to Custom Fields tree view item navTree.Find.WaitOnElementsTimeout = 20000; navTree.Find.ByTextContent("Materials").Parent<TreeViewItem>() .Find.ByType<ItemsPresenter>() .Find.ByName<ToggleButton>("ExpanderButton").User.Click(); navTree.Find.ByTextContent("Custom Fields").User.Click(); // Try to click Add button on the toolbar FrameworkElement dpMain = app.Find.ByExpression( new XamlFindExpression("Name=dpMain")); // this works FrameworkElement dragDockPanelHost = dpMain.Find.ByExpression( new XamlFindExpression("XamlTag=DragDockPanelHost")); // this works FrameworkElement widget = dragDockPanelHost.Find.ByExpression( new XamlFindExpression("XamlTag=WidgetBase")); // this returns nullThanks in advance!
Geoffrey