or
string userName = TestContext.DataRow["Username"].ToString();ActiveBrowser.NavigateTo("~/User/LogInPage.aspx");HtmlFindExpression untbExpr = new HtmlFindExpression("id=?RadTextBoxUserName_wrapper");ActiveBrowser.WaitForElement(untbExpr, 30000, false);RadTextBox usernameTb = ActiveBrowser.Find.ByExpression<RadTextBox>(untbExpr);usernameTb.Clear();usernameTb.TypeText(userName);HtmlFindExpression lbExpr = new HtmlFindExpression("id=?RadButtonLogin_input");ActiveBrowser.WaitForElement(lbExpr, 30000, false);RadButton loginButton = ActiveBrowser.Find.ByExpression<RadButton>(lbExpr);loginButton.MouseClick(); //Navigates to ~/Default.aspx but authenticated.//Throws errorHtmlFindExpression expr = new HtmlFindExpression("id=?RadToolBarMain");ActiveBrowser.WaitForElement(expr, 30000, false);RadToolBar tb = ActiveBrowser.Find.ByExpression<RadToolBar>(expr);RadToolBarItem lob = tb.FindItemByText("Log Off");//WORKS!!!//HtmlFindExpression loButton = new HtmlFindExpression("title=^Log Off", "class=rtbWrap");//ActiveBrowser.WaitForElement(loButton, 30000, false);//HtmlAnchor lob = ActiveBrowser.Find.ByExpression<HtmlAnchor>(loButton);//lob.MouseHover();const string JS = "( function() { var ls = []; for(var i = 0; i < 10; i++) ls.push({ Key: \"key_\" + i, Value: \"value_\" + i }); return ls; } )();";[TestMethod]public void testJavascriptReturnsDictionaryIe() { Manager.LaunchNewBrowser(BrowserType.InternetExplorer); ActiveBrowser.NavigateTo("http://www.telerik.com/products/free-testing-framework/overview.aspx"); var result = Actions.InvokeScript<Dictionary<string, string>>(JS);}[TestMethod]public void testJavascriptReturnsDictionaryFirefox() { Manager.LaunchNewBrowser(BrowserType.FireFox); ActiveBrowser.NavigateTo("http://www.telerik.com/products/free-testing-framework/overview.aspx"); var result = Actions.InvokeScript<Dictionary<string, string>>(JS);}[TestMethod]public void testJavascriptReturnsDictionaryChrome() { Manager.LaunchNewBrowser(BrowserType.Chrome); ActiveBrowser.NavigateTo("http://www.telerik.com/products/free-testing-framework/overview.aspx"); var result = Actions.InvokeScript<Dictionary<string, string>>(JS);}Manager.SetNewBrowserTracking(true);
Manager.Wait.For(browsers => Manager.Browsers.Count == 2, Manager.Browsers.Count, 100000);driver.Click("/html/body/div[8]/div/form/table/tbody/tr/td[5]/span"); driver.Click("//form[@id='POLinesform']/table/tbody/tr/td[@id='LineNumber' and text()='1']/../td[@id='Warehouse']"); driver.ClearSendKeysWithName("Warehouse", testPo.warehouse);// Browse to the login pageBrowser.NavigateTo("https://test.somedomain.com/Account/LogOn");// Enter the user name and passwordFind.ById<HtmlInputText>("UserName").Text = "UserName";Find.ById<HtmlInputPassword>("Password").Text = _strongPassword;// Now submit the formFind.ByAttributes<HtmlInputSubmit>("value=Confirm").Click();// Make sure we ended up on the categories page and the login succeededAssert.IsTrue(Browser.ContainsText("Categories / Products"));