or
//Find The main GridHtmlDiv GridDiv = ActiveBrowser.Find.ById<HtmlDiv>("globalSearchGrid");//Find The ContentHtmlDiv Content = GridDiv.Find.ByAttributes<HtmlDiv>("class=k-grid-content");HtmlTable ContenthtmlTable = Content.Find.ByTagIndex<HtmlTable>("table", 0);
ContenthtmlTable {HtmlTable:<table style="height: auto;" id="globalSearchGrid-grid-table" class="k-focusable" cellSpacing="0">}
HTML:
<table id="globalSearchGrid-grid-table" cellspacing="0" style="height: auto;" class="k-focusable"> <colgroup> <col /> <col /> <col /> <col /> <col /> </colgroup> <tbody> <tr> <td class=""><input type="checkbox" /></td> <td><span>Test Matter</span></td> <td><span>5000000092</span></td> <td><span>2007-03-22T00:00:00</span></td> <td><span>Open</span></td> </tr> <tr> <td><input type="checkbox" /></td> <td class=""><span>ITP Budget Matter 2</span></td> <td><span>5000000023</span></td> <td><span>2006-04-11T00:00:00</span></td> <td><span>Open</span></td> </tr> <tr> <td><input type="checkbox" /></td> <td><span>test123123123</span></td> <td><span>5000000098</span></td> <td><span>2007-08-20T00:00:00</span></td> <td><span>Open</span></td> </tr> </tbody></table>public string GetCellValue(){ string value; var textBlock = TableCell.Find.ByType<TextBlock>(); var sw = new System.Diagnostics.Stopwatch(); sw.Start(); value = textBlock.Text; //Takes on average 750 milliseconds sw.Stop(); Tracer.CaptureTiming( "GetCellValue", sw.Elapsed.Ticks ); //Capturing timing return value;}[TestFixture] [Parallelizable(TestScope.Descendants)] public class TelerikMbUnit1 : BaseTest { ConcurrentDictionary<string, Browser> browserDict = new ConcurrentDictionary<string, Browser>(); #region [ Setup / TearDown ] [SetUp] public void MyTestInitialize() { Initialize(false); // Launch new browser Manager.LaunchNewBrowser(BrowserType.FireFox, true); Browser browser = Manager.ActiveBrowser; browserDict.TryAdd(TestContext.CurrentContext.TestStep.ToString(), browser); } [TearDown] public void MyTestCleanUp() { // this.CleanUp(); Browser browser; browserDict.TryRemove(TestContext.CurrentContext.TestStep.ToString(), out browser); browser.Close(); } [FixtureTearDown] public void FixtureCleanup() { // This will shut down all browsers if // recycleBrowser is turned on. Else // will do nothing. ShutDown(); } #endregion [Test] public void SampleWebAiiTest0() { Browser browser = browserDict.Where(d => d.Key == TestContext.CurrentContext.TestStep.ToString()).Single().Value; // The active browser browser.NavigateTo("http://www.google.dk"); // Find the google search box and set it to "Telerik"; browser.Find.ByName<HtmlInputText>("q").Text = "Telerik"; // Click the Search button browser.Find.ByName<HtmlButton>("btnK").Click(); // Validate the search contain the 'Telerik' text Assert.IsTrue(browser.ContainsText("Telerik")); }[Owner("XMNN"), TestMethod][TestCategory("LockedScreenEnabled")][Description("Tests that an invalid login from masterpage redirets the user to /login")]public void MasterPageInvalidLoginTest() { string login = "invalid"; string pass = "invalid"; string error = "Combination of login and password was not correct"; ActiveBrowser.NavigateTo("~/"); // Invalid login MasterPage masterPage = new MasterPage(this); masterPage.LoginFromTopDropdown(login, pass, false, false); // Check that the login page is shown after invalid login LoginPage loginPage = new LoginPage(this,false); Assert.AreEqual(login, loginPage.GetUsernameInput().Text, "Incorrect login transfered from Masterpage login to LoginPage"); Assert.AreEqual(error, loginPage.GetLoginError().InnerText, "Incorrect login error message"); }