protected override void Execute(CodeActivityContext executionContext) { ITracingService tracingService = executionContext.GetExtension <ITracingService>(); IWorkflowContext context = executionContext.GetExtension <IWorkflowContext>(); IOrganizationServiceFactory serviceFactory = executionContext.GetExtension <IOrganizationServiceFactory>(); IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId); string htmlInput = HtmlInput.Get <string>(executionContext); tracingService.Trace("String supplied = " + htmlInput, htmlInput); string textOutput = string.Empty; //string pattern = "(<div.*>)(.*)(<\\/div>)"; //tracingService.Trace("Applying the following regex pattern: "+ pattern, pattern); //MatchCollection matches = Regex.Matches(htmlInput, pattern); //if (matches.Count > 0) //{ // foreach (Match m in matches) // { // StringOutput.Set(executionContext, HtmlToPlainText(m.Value)); // tracingService.Trace("The results returned are: "+m.Value , m.Value); // } //} StringOutput.Set(executionContext, HtmlToPlainText(htmlInput)); }
public static HtmlString ShowModalSearch(this HtmlHelper helper, string name) { var body = new System.Text.StringBuilder(); //var alert = new HtmlAlert() { Type = AlertType.danger, Id = "divAlertSearch", Message = "Informe o conteúdo da pesquisa", Title = "Atenção" }; var txtFilter = new HtmlInput() { Id = "txtApplyFilter", Class = "form-control", Required = true, Type = InputType.text, PlaceHolder = "texto da pesquisa" }; //body.AppendLine(alert.ToString()); body.AppendLine("<div id='divAlertSearch'></div>"); body.AppendLine(txtFilter.ToString()); var footer = new System.Text.StringBuilder(); var btnExit = new HtmlButton() { Id = "btnModalExit", Class = "btn btn-default", DataDismiss = "modal", Text = "Sair" }; var btnFilter = new HtmlButton() { Id = "btnModalFilter", Class = "btn btn-primary", Text = "Filtrar" }; footer.AppendLine(btnExit.ToString()); footer.AppendLine(btnFilter.ToString()); return(ShowModalDialog(helper, name, "Pesquisar", body.ToString(), footer.ToString())); }
public IActionResult HtmlInput() { HtmlInput model = new HtmlInput { Name = null }; return(View(model)); }
public static bool tbNewTask_onkeypress(HtmlInput textbox, HtmlDomEventArgs e) { //If enter is hit, blur the input if (e.keyCode == 13) { textbox.blur(); return(false); } return(true); }
public static bool tbNewTask_onkeypress(HtmlInput textbox, HtmlDomEventArgs e) { //If enter is hit, blur the input if (e.keyCode == 13) { textbox.blur(); return false; } return true; }
public void Login(string user, string password) { var page = wc.GetPage("https://passport.zujuan.com/login") as HtmlPage; //登录 HtmlInput ln = page.GetHtmlElementById("user-name") as HtmlInput; HtmlInput pwd = page.GetHtmlElementById("user-pwd") as HtmlInput; HtmlButton btn = page.GetFirstByXPath("/html/body/div[1]/div[1]/form/div[1]/div[3]/button") as HtmlButton; ln.SetAttribute("value", user); pwd.SetAttribute("value", password); HtmlPage page2 = btn.Click() as HtmlPage; //todo check login status //登录完成,现在可以爬取任意你想要的页面了。 }
public static bool tbNewTask_onblur(HtmlInput textbox) { //when input is blured, insert a new item if it is not empty if (textbox.value == null || textbox.value == "") return false; var li = document.createElement("li"); li.appendChild(document.createTextNode(textbox.value)); var liNewTask = document.getElementById("liNewTask"); liNewTask.insertAdjacentElement("beforeBegin", li); //reset the input to blank textbox.value = ""; textbox.focus(); return true; }
public void DoWikipediaSearch() { // Note that this test works against live wikipedia.org and requires an active Internet connection WebClient webClient = new WebClient(BrowserVersion.FIREFOX_3_6) { JavaScriptEnabled = true, ActiveXNative = true, CssEnabled = true, }; HtmlPage page = webClient.GetHtmlPage("http://wikipedia.org"); HtmlInput queryInputElement = page.GetElementById <HtmlInput>("searchInput"); queryInputElement.Type("network"); HtmlSubmitInput submitButton2 = page.HtmlElementDescendants .OfType <HtmlSubmitInput>() .First(e => e.NameAttribute == "go"); submitButton2.Click(); HtmlElement submitButton = page.GetElementByName("go"); HtmlPage nextPage = submitButton.Click <HtmlPage>(); // Check whether enumeration works (at least that it doesnt crash) foreach (var child in nextPage.Body.HtmlElementDescendants) { Console.WriteLine(child.TreeDepth + ": Child in enumerator is " + child); } int i = 0; // Check whether list wrapper works foreach (var child in nextPage.Forms) { Console.WriteLine(child); Assert.AreEqual(child, nextPage.Forms[i]); i++; } }
public static bool tbNewTask_onblur(HtmlInput textbox) { //when input is blured, insert a new item if it is not empty if (textbox.value == null || textbox.value == "") { return(false); } var li = document.createElement("li"); li.appendChild(document.createTextNode(textbox.value)); var liNewTask = document.getElementById("liNewTask"); liNewTask.insertAdjacentElement("beforeBegin", li); //reset the input to blank textbox.value = ""; textbox.focus(); return(true); }
public static HtmlString Pagination(this HtmlHelper helper, string id, List <HtmlButton> buttons) { #region Inicialização // opções de paginação do DropDown var options = new int[] { 10, 20, 30, 40, 50, 100 }; #endregion Inicialização var text = new System.Text.StringBuilder(); text.AppendLine(string.Format("<div id='{0}' name='{0}' class='row'>", id)); text.AppendLine(" <div class='col-md-12' style='background-color: #f5f5f5; height: 40px; padding: 7px 0 0 0'>"); #region Adiciona os botões incluir e pesquisar text.AppendLine(" <div class='col-md-4'>"); foreach (var but in buttons) { text.AppendLine(but.ToString()); } text.AppendLine(" </div>"); #endregion Adiciona os botões a barra de paginação #region Botões de navegação var btnFirst = new HtmlButton() { Id = "btnFirst", Class = "btn btn-default btn-xs", Icon = "icon-double-angle-left", Title = "Primeira página" }; var btnPrev = new HtmlButton() { Id = "btnPrev", Class = "btn btn-default btn-xs", Icon = "icon-angle-left", Title = "Página anterior" }; var inputPage = new HtmlInput() { Id = "txtPage", Class = "ui-pg-input", Type = InputType.text, Role = "textbox", Size = 2, MaxLenght = 4 }; var btnNext = new HtmlButton() { Id = "btnNext", Class = "btn btn-default btn-xs", Icon = "icon-angle-right", Title = "Próxima página" }; var btnLast = new HtmlButton() { Id = "btnLast", Class = "btn btn-default btn-xs", Icon = "icon-double-angle-right", Title = "Última página" }; #endregion Botões de navegação text.AppendLine(" <div class='col-md-6' style='margin-top: -3px'>"); text.AppendLine(btnFirst.ToString()); text.AppendLine(btnPrev.ToString()); text.AppendLine(String.Format(" | Página {0} de <span id='spnPages'></span> | ", inputPage.ToString())); text.AppendLine(btnNext.ToString()); text.AppendLine(btnLast.ToString()); text.AppendLine(" <select id='cbxPages' class='ui-pg-selbox' role='listbox'></select>"); text.AppendLine(" </div>"); text.AppendLine(" <div class='col-md-2' style='text-align:right'>"); text.AppendLine(" Linhas: <span id='spnFirstRecord'></span> - <span id='spnLastRecord'></span> de <span id='spnRecords'></span>"); text.AppendLine(" </div>"); text.AppendLine(" </div>"); text.AppendLine("</div>"); return(new HtmlString(text.ToString())); }
public void Init() { htmlInput = new HtmlInput(); htmlWeb = new HtmlWeb(); }
public IActionResult HtmlInput(HtmlInput model) { return(View(model)); }
protected ToggleSwitch(IWebElement webElement, HtmlInput inputElement) : base(webElement) { _inputElement = inputElement; }