public void CodedUITestMethod1() { BrowserWindow browser = BrowserWindow.Launch(new Uri("http://*****:*****@gmail.com"); HtmlEdit Password_txtbox = new HtmlEdit(browser); Password_txtbox.SearchProperties.Add(HtmlEdit.PropertyNames.Id, "Password"); Password_txtbox.SetFocus(); Keyboard.SendKeys("144685"); HtmlEdit ConPassword_txtbox = new HtmlEdit(browser); ConPassword_txtbox.SearchProperties.Add(HtmlEdit.PropertyNames.Id, "ConfirmPassword"); ConPassword_txtbox.SetFocus(); Keyboard.SendKeys("144685"); }
/// <summary> /// Set focus to the HTML input control and type all characters from passed string one by one. /// </summary> /// <param name="inputControl">Input to type text on.</param> /// <param name="text">Text to be typed to the control.</param> /// <param name="append">Determines control will be cleaned before start typing.</param> public static void TypeText(this HtmlEdit inputControl, string text, bool append = false) { if (inputControl == null) { throw new ArgumentNullException("inputControl"); } if (string.IsNullOrWhiteSpace(text)) { throw new ArgumentNullException("text"); } inputControl.SetFocus(); Assert.IsTrue(!inputControl.ReadOnly && inputControl.Enabled, "Control is disabled or read-only."); if (!append) { inputControl.Text = string.Empty; } inputControl.Text = text; }