or
var radColorPicker = app.MainWindow.Find.AllByType<RadColorPicker>();radColorPicker[0].SelectItem(0, 1);Manager manager = new Manager(false);manager.Start(); WpfApplication wpfApplication = manager.LaunchNewApplication(@"Wpf.Application1.exe");WpfWindow wpfWindow = wpfApplication.GetWindow("MainWindow");wpfWindow.Find.ByName<Button>("button2").User.Click(); //The new WPF window is shown, how can I attach to it?//Service that actively monitors a spesific HTML DOM Object for changes//IF the HTMLControl is found the object monitored, a true is setnamespace Newton2_Automation.SharedFunctionLib{ public class MonitorHtmlObject { public MonitorHtmlObject(HtmlControl monitorControl, string htmlId = null, string htmlClass = null) { _monitorControl = monitorControl; _htmlId = htmlId; _htmlClass = htmlClass; } public void Start() { oThread = new Thread(new ThreadStart(HTMLRunner)); oThread.Start(); while (!oThread.IsAlive) ; } public bool Output; public void Stop() { oThread.Abort(); } private void HTMLRunner() { Output = false; while (true) { try { if ((monitorControl.Find.ByAttributes(_htmlId)) != null) { Output = true; } } catch { continue; } _monitorControl.Refresh(); } } private Thread oThread; private HtmlControl _monitorControl; private HtmlControl monitorControl { get { while (_monitorControl.IsRefresh == true) { Thread.Sleep(100); } return _monitorControl; } } private string _htmlId; private string _htmlClass; }}foreach (HtmlDiv col in getPlaceHolders) { int ColCounbt = new int(); try { ColCounbt = col.Find.ByTagIndex("ul", 0).ChildNodes.Count; } catch { ColCounbt = 0; continue; } if (ColCounbt > 0) { HtmlListItem[] GagetColection = new HtmlListItem[col.Find.ByTagIndex("ul", 0).ChildNodes.Count]; for (int i = 0; i < GagetColection.Count(); i++) { GagetColection[i] = ((HtmlUnorderedList)(col.Find.ByTagIndex<HtmlUnorderedList>("ul", 0))).ChildNodes[i].As<HtmlListItem>(); } foreach (HtmlListItem item in GagetColection) { HtmlUnorderedList toCol = getPlaceHolders[sf.GenRandomNum(0, getPlaceHolders.Count())].Find.ById<HtmlUnorderedList>("undefinedGadgetHolder"); item.Refresh(); HtmlDiv GadgetHeader = item.Find.ByAttributes<HtmlDiv>("class=~gadget-head"); MonitorHtmlObject monitor = new MonitorHtmlObject(toCol, "class=gadget-placeholder"); monitor.Start(); GadgetHeader.DragTo(toCol, OffsetReference.AbsoluteCenter, Point.Empty); Log.WriteLine(monitor.Output.ToString()); monitor.Stop(); ActiveBrowser.WaitForAjax(10000); System.Threading.Thread.Sleep(5000); } } }<telerik:RadGridView Grid.Row="3" Margin="15,15,15,0" Name="meterGrid" VerticalAlignment="Top" HorizontalAlignment="Left" IsReadOnly="True" Opacity="100" RowIndicatorVisibility="Collapsed" Grid.Column="0" Grid.ColumnSpan="3" AutoGenerateColumns="False" SelectionMode="Single" telerik:StyleManager.Theme="Office_Blue" Height="250" RowActivated="meterGrid_RowActivated" > <!--Fade In Animaiton--><!--<telerik:RadGridView.Resources><Storyboard x:Name="_animationGridLoad"><DoubleAnimation Storyboard.TargetName="meterGrid" Storyboard.TargetProperty="Opacity" From="0.0" To="1.0" Duration="0:0:2" AutoReverse="false" /></Storyboard></telerik:RadGridView.Resources>--><!--Right Click Context Menu--><telerik:RadContextMenu.ContextMenu> <telerik:RadContextMenu ItemClick="RadContextMenu_ItemClick"> <telerik:RadContextMenu.Items> <telerik:RadMenuItem Header="Create New Meter" CommandParameter="Create" /> <telerik:RadMenuItem Header="Edit Meter Details" CommandParameter="Edit" /> <telerik:RadMenuItem Header="Delete Meter" CommandParameter="Delete" /> <telerik:RadMenuItem Header="View on Map" CommandParameter="View" /> <telerik:RadMenuItem Header="View Meter History" CommandParameter="History" /> <telerik:RadMenuItem Header="View Documents" CommandParameter="DocLibrary" /> </telerik:RadContextMenu.Items> </telerik:RadContextMenu></telerik:RadContextMenu.ContextMenu><!--Display Columns--><telerik:RadGridView.Columns> <telerik:GridViewDataColumn Width="*" Header="Meter Name" DataMemberBinding="{Binding MeterName}" /> <telerik:GridViewDataColumn Width="*" Header="Manufacturer" DataMemberBinding="{Binding MainManufacturer}" /> <telerik:GridViewDataColumn Width="*" Header="M.C. Approval" DataMemberBinding="{Binding MainMCApprovalNum}" /> <telerik:GridViewDataColumn Width="*" Header="CT Ratio" DataMemberBinding="{Binding CTRatio}" /> <telerik:GridViewDataColumn Width="*" Header="Meter ID" DataMemberBinding="{Binding MeterID}" /></telerik:RadGridView.Columns></telerik:RadGridView>[TestMethod]public void SampleWebAiiTest(){ Settings.Current.Web.EnableSilverlight = true; Manager.LaunchNewBrowser(); ActiveBrowser.NavigateTo("http://demos.telerik.com/silverlight/#ComboBox/FirstLook"); SilverlightApp app = ActiveBrowser.SilverlightApps()[0]; Telerik.WebAii.Controls.Xaml.RadComboBox cb = app.Find.ByAutomationId<Telerik.WebAii.Controls.Xaml.RadComboBox>("TechnologySelection"); Assert.IsNotNull(cb); cb.SelectItem("Silverlight", true); Assert.AreEqual("Silverlight", cb.Text); // Not working, Expected <Silverlight>, Actual <> System.Threading.Thread.Sleep(1000);}