or
[Test]public void SampleWebAiiTest(){ Settings.Current.Web.EnableSilverlight = true; // Launch a browser instance Manager.LaunchNewBrowser(BrowserType.InternetExplorer); // The active browser ActiveBrowser.NavigateTo("http://demos.telerik.com/silverlight/#GridView/PagingLargeData"); SilverlightApp app = ActiveBrowser.SilverlightApps()[0]; int verticalOffset = 0; // Holds the current vertical offset in the viewport int viewPortHeight; // The height of the visible part of the grid int extentHeight; // The total height of the grid, visible plus non-visible // Copy the RadGridView into a local variable as a shortcut RadGridView grid = app.Find.ByAutomationId<RadGridView>("GridView"); // Grab the VirtualizingPanel contained in the RadGridView. This is used to control the viewable portion of the grid. FrameworkElement virtualizingPanel = grid.Find.ByType("GridViewVirtualizingPanel"); // Detect the view port height and the extent height viewPortHeight = (int)virtualizingPanel.GetProperty(new AutomationProperty("ViewportHeight", typeof(int))); extentHeight = (int)virtualizingPanel.GetProperty(new AutomationProperty("ExtentHeight", typeof(int))); // Make sure it is scrolled to the very top // Walk through the entire grid verifying the data virtualizingPanel.InvokeMethod("SetVerticalOffset", 0); int index; int totalCount = 0; string rowText; while (verticalOffset < extentHeight) { foreach (GridViewRow r in grid.Rows) { totalCount++; index = r.Index; rowText = string.Join(", ", r.Cells.Select(item => item.Text)); } // Scroll down one page verticalOffset += viewPortHeight; virtualizingPanel.InvokeMethod("SetVerticalOffset", verticalOffset); }}Manager testManager = new Manager(false);
testManager.Start();
testManager.LaunchNewBrowser(BrowserType.InternetExplorer, true);
testManager.ActiveBrowser.NavigateTo("http://google.com");
for (int i = 0; i < 20; i++)
{
Console.WriteLine("Current: " + testManager.ActiveBrowser.GetSelectedText());
Thread.Sleep(1000);
}
Console.ReadLine();
testManager.Dispose();
// Handle 'Generic' dialog. GenericDialog genericDialog = new GenericDialog(ActiveBrowser, "Modeling Scenario", true, "Submit Completed Successfully"); genericDialog.ButtonId = 2; Manager.DialogMonitor.AddDialog(genericDialog);DownloadDialogsHandler exportDownload = new DownloadDialogsHandler(Manager.ActiveBrowser, DialogButton.SAVE, fileSave, Desktop);Manager.Settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle;Manager.DialogMonitor.Start();HtmlControl exportSelectCSV = new HtmlControl(Find.ByAttributes("class=~SiteExportLink"));exportSelectCSV.Click();exportDownload .WaitUntilHandled(); if (File.Exists(fileSave + "export.csv"))
{ File.Delete(fileSave + "export.csv"); } SaveAsDialog saveExport = new SaveAsDialog(ActiveBrowser, DialogButton.SAVE, fileSave + "export.csv", Desktop); Manager.DialogMonitor.AddDialog(saveExport); IEDownloadDialog ieDialog = new IEDownloadDialog(ActiveBrowser, DialogButton.SAVE, Desktop); Manager.DialogMonitor.AddDialog(ieDialog); IEDownloadCompleteDialog dlComplete = new IEDownloadCompleteDialog(ActiveBrowser, DialogButton.CLOSE, Desktop); Manager.DialogMonitor.AddDialog(dlComplete); Manager.Settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle; Manager.DialogMonitor.Start(); HtmlControl exportSelectCSV = new HtmlControl(Find.ByAttributes("class=~SiteExportLink")); exportSelectCSV.Click(); ieDialog.WaitUntilHandled(); saveExport.WaitUntilHandled(); dlComplete.WaitUntilHandled();