public void TestAlterDescription() { WatiN.Core.IE window = ie; ie.GoTo("http://localhost:13164/Photo/PhotoAlbumManager.aspx"); base.Login(ie); Button btn_ctl00ContentPlac = window.Button(Find.ByName("ctl00$ContentPlaceHolder1$PhotoAlbumManager1$grdPhotoAlbum$ctl04$Button1")); Assert.That(btn_ctl00ContentPlac.Exists); Span spn_ctl00_ContentPla = window.Span(Find.ById("ctl00_ContentPlaceHolder1_PhotoAlbumManager1_frmEdit_rptPhoto_ctl00_SinglePhotoThumbnail1_lblDescription")); Assert.That(spn_ctl00_ContentPla.Exists); //Added after the registration TextField txt_editCurrent = window.TextField(Find.ById("editCurrent")); Assert.That(txt_editCurrent.Exists); txt_editCurrent.WaitUntilExists(3000); window.GoTo("http://localhost:13164/Photo/PhotoAlbumManager.aspx"); btn_ctl00ContentPlac.Click(); spn_ctl00_ContentPla.Click(); txt_editCurrent.Click(); txt_editCurrent.AppendText("!!"); txt_editCurrent.KeyDown('\n'); }
//public override string IHTMLElementValue //{ // get // { // string val = ""; // var el = GetElement(); // if (ElementType == ElementTypes.TextField) { // val = el.GetAttributeValue("value").ToString(); // }else{ // val = el.GetAttributeValue("Innerhtml").ToString(); // } // return val; // } //} public override void Perform() { string val = Eval(MapName); if (!string.IsNullOrEmpty(val)) { TextToType = val; } var constraint = GetConstraint(); if (ElementType == ElementTypes.TextField || ElementType == ElementTypes.ValidateCode) { TextField field = GetWindow().TextField(constraint); TextToType = Format(TextToType); //获取纯文本 TextToType = StringParser.removeHtml(TextToType); if (string.IsNullOrEmpty(TextToType)) { return; } if (ValueOnly) { field.Value = TextToType; } else if (Overwrite) { field.TypeText(TextToType); } else { field.AppendText(TextToType); } } else { var el = GetElement(); string text = TextToType; //if (ScriptCaller.LinkCreator != null) { // text = ScriptCaller.LinkCreator.Create(text); //} el.SetAttributeValue("Innerhtml", text.Replace("\n", "<br/>")); //Rectangle rect = Window.GeScreenPosition(el.GetHtmlElement()); //MouseSimulator.Position = new Point(rect.X + rect.Width / 2, rect.Y + rect.Height / 2); //MouseSimulator.Click(MouseButton.Left); //Clipboard.SetText(text); //Window.GetMyBrowser().ExecCommand(false, "Paste", false, text); } }
public void appendText(string text) { if (element == null) { return; } TextField textField = element as TextField; if (textField == null) { return; } textField.AppendText(text); }
private void Five_Click(object sender, EventArgs e) { if (equalsClicked) { TextField.Clear(); num1 = ""; num2 = ""; number1 = 0.0; number2 = 0.0; operation = ""; } TextField.AppendText("5"); }
private void Decimal_Click(object sender, EventArgs e) { TextField.AppendText("."); }