public void Click(HtmlElement h) { Focus(h); Over(h); Down(h); h.InvokeMember("click"); }
private void WebBrowserInvokeMember(HtmlElement h, string action) { h.InvokeMember(action); DateTime dt = DateTime.Now; WebBrowserReadyState readyState = GetWebBrowserReadyState(); while (readyState != WebBrowserReadyState.Complete /*&& webBrowser1.ReadyState != WebBrowserReadyState.Loaded*/ && (DateTime.Now - dt).TotalSeconds < 10) { Application.DoEvents(); Thread.Sleep(100); } Application.DoEvents(); Thread.Sleep(1000); }
// DocumentCompleted event handle void IEBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { HtmlDocument doc = ((WebBrowser)sender).Document; ieBrowser.DocumentCompleted -= IEBrowser_DocumentCompleted; System.Windows.Forms.HtmlElement search = ieBrowser.Document.GetElementById("name1"); if (search != null) { search.SetAttribute("value", "verinon"); System.Windows.Forms.HtmlElement searchButton = ieBrowser.Document.GetElementById("checkCompanyName_0"); searchButton.InvokeMember("click"); ieBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(IEBrowser_DocumentCompleted1); } }
void IEBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { HtmlDocument doc = ((WebBrowser)sender).Document; ieBrowser.DocumentCompleted -= IEBrowser_DocumentCompleted; //System.Windows.Forms.HtmlElement cntrlEnail = ieBrowser.Document.GetElementById("login-email"); //System.Windows.Forms.HtmlElement cntrlPassword = ieBrowser.Document.GetElementById("login-password"); //System.Windows.Forms.HtmlElement cntrlSubmit = ieBrowser.Document.GetElementById("login-submit"); System.Windows.Forms.HtmlElement cntrlEnail = ieBrowser.Document.GetElementById("session_key-login"); System.Windows.Forms.HtmlElement cntrlPassword = ieBrowser.Document.GetElementById("session_password-login"); System.Windows.Forms.HtmlElement cntrlSubmit = ieBrowser.Document.GetElementById("btn-primary"); if (cntrlEnail != null && cntrlPassword != null && cntrlSubmit != null) { cntrlEnail.SetAttribute("value", "*****@*****.**"); cntrlPassword.SetAttribute("value", "kareti1024"); cntrlSubmit.InvokeMember("click"); ieBrowser.DocumentCompleted += IeBrowser_DocumentCompleted; } }
private void IeBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { ieBrowser.DocumentCompleted -= IeBrowser_DocumentCompleted; string value = string.Empty; System.Windows.Forms.HtmlElement loginCallOut = ieBrowser.Document.GetElementById("login-callout"); if (loginCallOut != null && loginCallOut.InnerText.Contains("Trying to sign in?")) { System.Windows.Forms.HtmlElement cntrlEnail = ieBrowser.Document.GetElementById("login-email"); System.Windows.Forms.HtmlElement cntrlPassword = ieBrowser.Document.GetElementById("login-password"); System.Windows.Forms.HtmlElement cntrlSubmit = ieBrowser.Document.GetElementById("login-submit"); if (cntrlEnail != null && cntrlPassword != null && cntrlSubmit != null) { cntrlEnail.SetAttribute("value", "*****@*****.**"); cntrlPassword.SetAttribute("value", "kareti1024"); cntrlSubmit.InvokeMember("click"); ieBrowser.DocumentCompleted += IeBrowser_DocumentCompleted1; } } }
public void Click(HtmlElement elem) { elem.InvokeMember("click"); }
//Insert values public void vl1f() { hElement1 = webBrowser1.Document.GetElementById(textBoxJSLogin.Text); hElement1.SetAttribute("value", textBoxBrowserLogin.Text); hElement2 = webBrowser1.Document.GetElementById(textBoxJSPass.Text); hElement2.SetAttribute("value", textBoxBrowserPassword.Text); hElement3 = webBrowser1.Document.GetElementById(textBoxJSForm.Text); hElement3.InvokeMember(textBoxJSSubmit.Text); }
async Task PopulateInputFile(HtmlElement file, String photo) { file.Focus(); // delay the execution of SendKey to let the Choose File dialog show up var sendKeyTask = TaskEx.Delay(500).ContinueWith((_) => { // this gets executed when the dialog is visible SendKeys.SendWait(photo + "{ENTER}"); }, TaskScheduler.FromCurrentSynchronizationContext()); file.InvokeMember("Click"); // this shows up the dialog await sendKeyTask; file.RemoveFocus(); // delay continuation to let the Choose File dialog hide await TaskEx.Delay(500); }
public void click(HtmlElement elm) { if (elm == null) return; elm.InvokeMember("click"); }
public void Up(HtmlElement h) { h.InvokeMember("fireEvent", new object[] { "onkeyup" }); }
public void Down(HtmlElement h) { h.InvokeMember("fireEvent", new object[] { "onkeydown" }); }
private void timer1_Tick(object sender, EventArgs e) { switch (step) { case 1: step = 0; toolStep.Text = "Étape : 1"; hotmailer.webBrowser1.Navigate("http://google.com"); hotmailer.Show(); step = 2; break; case 2: step = 0; toolStep.Text = "Étape : 2"; identity = hotmailer.webBrowser1.Document.GetElementById("identity"); /* * Modifications for GAF * */ SendKeys.Send("test"); ClearCookies(); WebBrowserHelper.ClearCache(); break; if (identity != null) { // Entre mot de passe identity.Focus(); SendKeys.Send("loubna"); if (identity.GetAttribute("value") != "loubna") { // La page n'était pas chargée step = 2; return; } // Entre code de campagne. campaignCode = hotmailer.webBrowser1.Document.GetElementById("campaignCode"); campaignCode.Focus(); SendKeys.SendWait(codeDeCampagne); while (campaignCode.GetAttribute("value") != codeDeCampagne) { campaignCode.Focus(); // Problème quelconque: on efface l'input et recommence. while (campaignCode.GetAttribute("value") != "") { SendKeys.SendWait("{BACKSPACE}"); } SendKeys.SendWait(codeDeCampagne); } // Clique sur une DIV invisble ayant onclick="next();": simule un "{ENTER}" pressEnter = hotmailer.webBrowser1.Document.GetElementById("pressEnter"); pressEnter.InvokeMember("click"); step = 3; } else { step = 2; } break; case 3: step = 0; toolStep.Text = "Étape : 3"; // Collecte le compte Yahoo address = hotmailer.webBrowser1.Document.GetElementById("address"); strAddress = address.GetAttribute("value"); if (strAddress == "") { // La page n'était pas chargée step = 3; return; } // Collecte le mot de passe password = hotmailer.webBrowser1.Document.GetElementById("password"); strPassword = password.GetAttribute("value"); // Collecte le récipient recipient = hotmailer.webBrowser1.Document.GetElementById("recipient"); strRecipient = recipient.GetAttribute("value"); // Collecte le sujet subject = hotmailer.webBrowser1.Document.GetElementById("subject"); strSubject = subject.GetAttribute("value"); username = webBrowser1.Document.GetElementById("username"); if (username == null) { // Déjà loggé hotmailer.Hide(); step = 6; } else { step = 4; } break; case 4: step = 0; toolStep.Text = "Étape : 4"; hotmailer.Hide(); // Injecte le nom de compte Yahoo username = webBrowser1.Document.GetElementById("username"); if (username != null) { username.InvokeMember("focus"); SendKeys.SendWait(strAddress); webBrowser1.Document.ExecCommand("SelectAll", true, null); webBrowser1.Document.ExecCommand("Copy", true, null); if (Clipboard.GetText() != strAddress) { // L'adresse n'a pas bien ete transmise SendKeys.SendWait("^{BACKSPACE}"); step = 4; break; } else { SendKeys.SendWait("{TAB}"); webBrowser1.Document.ExecCommand("SelectAll", true, null); SendKeys.SendWait("^{BACKSPACE}"); // Injecte le mot de passe passwd = webBrowser1.Document.GetElementById("passwd"); passwd.InvokeMember("focus"); SendKeys.SendWait(strPassword); step = 5; } } else { if (webBrowser1.Document.GetElementById("compose_button_label") != null) { // Login déjà fait. Page chargée. step = 6; } else { step = 4; } } break; case 5: step = 0; toolStep.Text = "Étape : 5"; loginCounter = 0; webBrowser1.Document.ExecCommand("SelectAll", true, null); webBrowser1.Document.ExecCommand("Copy", true, null); if (Clipboard.GetText() == strAddress || Clipboard.GetText().IndexOf("●") != -1) { // Nous sommes bien dans un input dans contenant l'adresse ou le mot de passe SendKeys.SendWait("{ENTER}"); step = 6; } else { step = 4; } // Envoie la form (ID du bouton connection: ".save") /*dotSave = webBrowser1.Document.GetElementById(".save"); if (dotSave != null) { dotSave.InvokeMember("click"); loginCounter = 0; step = 6; } else { step = 5; }*/ break; case 6: step = 0; toolStep.Text = "Étape : 6"; if (webBrowser1.Document.GetElementById("compose_button_label") != null) { // Injecte N pour ouvrir l'onglet nouveau message SendKeys.SendWait("n"); textAreas = webBrowser1.Document.GetElementsByTagName("textarea"); if (textAreas.Count < 3) { step = 6; } else { step = 7; } } else { loginCounter++; if (loginCounter >= 5) { // Apres 5 tentatives, re-login step = 4; } else{ step = 6; } } break; case 7: step = 0; toolStep.Text = "Étape : 7"; textAreas = null; textAreas = webBrowser1.Document.GetElementsByTagName("textarea"); // Parcours tous les éléments TextArea pour trouver l'ID du champ "À:" (qui est aléatoire mais commence toujours par "Toi") for (int i = 0; i <= textAreas.Count - 1; i++) { aID = textAreas[i].GetAttribute("id"); if (aID.Length > 3) { if (aID.Substring(0, 3) == "Toi") { aArea = webBrowser1.Document.GetElementById(aID); aArea.InvokeMember("focus"); SendKeys.SendWait(strRecipient); step = 8; break; } } } break; case 8: step = 0; toolStep.Text = "Étape : 8"; // Vérifie que "À:" contient la bonne adresse aArea = webBrowser1.Document.GetElementById(aID); aArea.InvokeMember("focus"); webBrowser1.Document.ExecCommand("SelectAll", true, null); webBrowser1.Document.ExecCommand("Copy", true, null); //webBrowser1.Document.ExecCommand("Unselect", true, null); if (Clipboard.GetText() != strRecipient) { // Échec: input récipient vide ou incomplet aArea.InvokeMember("focus"); SendKeys.SendWait(strRecipient); step = 8; } else { step = 9; } break; case 9: step = 0; toolStep.Text = "Étape : 9"; // TAB à l'input "Sujet", au cas ou Focus() fail SendKeys.SendWait("{TAB}"); SendKeys.SendWait("{TAB}"); inputs = webBrowser1.Document.GetElementsByTagName("input"); // Parcours tous les éléments Input pour trouver l'ID du champ "Objet:" (qui est aléatoire mais commence toujours par "Subject") for (int i = 0; i <= inputs.Count - 1; i++) { subjectID = inputs[i].GetAttribute("id"); if (subjectID.Length > 6) { if (subjectID.Substring(0, 7) == "Subject") { input = webBrowser1.Document.GetElementById(subjectID); input.InvokeMember("focus"); SendKeys.SendWait(strSubject); step = 10; break; } } } break; case 10: step = 0; toolStep.Text = "Étape : 10"; // Vérifie que "Objet:" contient le bon message input = webBrowser1.Document.GetElementById(subjectID); input.InvokeMember("focus"); webBrowser1.Document.ExecCommand("SelectAll", true, null); webBrowser1.Document.ExecCommand("Copy", true, null); //webBrowser1.Document.ExecCommand("Unselect", true, null); if (Clipboard.GetText() != strSubject) { // Échec: input sujet vide ou incomplet input.InvokeMember("focus"); SendKeys.SendWait(strSubject); step = 10; } else { // Tab à la textArea du message SendKeys.SendWait("{TAB}"); hotmailer.Show(); step = 11; } break; case 11: step = 0; toolStep.Text = "Étape : 11"; // Focus sur l'IFRAME. subject = hotmailer.webBrowser1.Document.GetElementById("subject"); subject.Focus(); SendKeys.SendWait("{TAB}"); // Vide le clipboard Clipboard.Clear(); // CTRL + A, CTRL + C pour transférer le message au clipboard hotmailer.webBrowser1.Document.ExecCommand("SelectAll", true, null); hotmailer.webBrowser1.Document.ExecCommand("Copy", true, null); if (Clipboard.GetText().IndexOf("Si vous souhaitez ne plus recevoir cette newsletter") == -1) { // Échec: IFRAME non chargé, clipboard vide ou incomplet step = 11; } else { hotmailer.webBrowser1.Document.ExecCommand("Unselect", true, null); hotmailer.Hide(); step = 12; } break; case 12: step = 0; toolStep.Text = "Étape : 12"; // Injecte le message webBrowser1.Document.ExecCommand("Paste", true, null); // Vérifie que le champ du message n'est pas vide /*input = webBrowser1.Document.GetElementById(subjectID); input.InvokeMember("focus");*/ SendKeys.SendWait("{TAB}"); webBrowser1.Document.ExecCommand("SelectAll", true, null); webBrowser1.Document.ExecCommand("Copy", true, null); webBrowser1.Document.ExecCommand("Unselect", true, null); if (Clipboard.GetText().IndexOf("Si vous souhaitez ne plus recevoir cette newsletter") == -1) { // Échec: message absent ou incomplet step = 12; } else { // Remonte à "Cc:" SendKeys.SendWait("+{TAB}"); SendKeys.SendWait("+{TAB}"); // Injecte un espace dans "Cc:" pour pouvoir vérifier s'il ne contient que cela (s'il est vide, CTRL+A CTRL+C ne l'indique pas) SendKeys.SendWait(" "); step = 13; } break; case 13: step = 0; toolStep.Text = "Étape : 13"; isCcEmpty(); // Remonte à "À:" (SHIT+TAB) au cas où focus fail SendKeys.SendWait("+{TAB}"); step = 14; break; case 14: step = 0; toolStep.Text = "Étape : 14"; isRecipientValid(); // Descend à "Sujet:" (TAB) au cas où focus fail SendKeys.SendWait("{TAB}"); SendKeys.SendWait("{TAB}"); step = 15; break; case 15: step = 0; toolStep.Text = "Étape : 15"; isSubjectValid(); step = 16; break; case 16: step = 0; toolStep.Text = "Étape : 16"; // Envoie le message (CTRL + ENTER) SendKeys.SendWait("^{ENTER}"); // Clique a une certaine coordonnée, là où le message de bienvenue de Yahoo peut apparaître //clickOnWebBrowser(535, 450); step = 17; break; case 17: step = 0; captchaCounter = 0; toolStep.Text = "Étape : 17"; // Vérification de captcha // Si 3 inputs ont comme ID "firstName[...]", le message est envoyé. messageSent = webBrowser1.Document.GetElementsByTagName("input"); for (int i = 0; i <= messageSent.Count - 1; i++) { messageSentID = messageSent[i].GetAttribute("id"); if (messageSentID.IndexOf("firstName") != -1) { captchaCounter++; } if (messageSentID.IndexOf("captcha_resp") != -1) { // Captcha! step = 19; goto Fin; } } if (captchaCounter >= 3) { // Message envoyé, ferme l'onglet (CTRL+BACKSPACE) step = 18; SendKeys.Send("^{BACKSPACE}"); } else { // "Envoi du message..." step = 17; } Fin: break; case 18: step = 0; toolStep.Text = "Étape : 18"; // Génère prochain mail. pressEnter = hotmailer.webBrowser1.Document.GetElementById("pressEnter"); if (pressEnter != null) { hotmailer.Show(); pressEnter.InvokeMember("click"); step = 20; } else { step = 18; } break; case 19: step = 0; toolStep.Text = "Étape : 19"; // Reset le compteur de /tool pressEscape = hotmailer.webBrowser1.Document.GetElementById("pressEscape"); if (pressEscape != null) { hotmailer.Show(); pressEscape.InvokeMember("click"); // Génère un nouveau compte Yahoo pressEnter.InvokeMember("click"); step = 20; } else { step = 19; } break; case 20: step = 0; toolStep.Text = "Étape : 20"; // Attend que le récipient ai changé (page chargée) recipient = hotmailer.webBrowser1.Document.GetElementById("recipient"); string tmpRecipient = recipient.GetAttribute("value"); if (tmpRecipient != strRecipient && tmpRecipient != null && tmpRecipient != "") { //iteration++; address = hotmailer.webBrowser1.Document.GetElementById("address"); string tmpAddress = address.GetAttribute("value"); if (tmpAddress != strAddress) { iteration++; strAddress = tmpAddress; strRecipient = tmpRecipient; // Collecte le mot de passe password = hotmailer.webBrowser1.Document.GetElementById("password"); strPassword = password.GetAttribute("value"); // Efface les cookies ClearCookies(); // Efface le cache WebBrowserHelper.ClearCache(); // Ferme la session InternetSetOption(IntPtr.Zero, INTERNET_OPTION_END_BROWSER_SESSION, IntPtr.Zero, 0); // Rafraîchit la page webBrowser1.Document.Window.Navigate("http://login.yahoo.com/config/login_verify2?.intl=fr&.src=ym"); //webBrowser1.Document.Window.Navigate("http://mail.yahoo.fr"); step = 4; } else { hotmailer.Hide(); strRecipient = tmpRecipient; step = 6; //iteration++; } } else { step = 20; } break; } }
public void Move(HtmlElement h) { h.InvokeMember("fireEvent", new object[] { "onmousemove" }); }
public bool ClickNextPage(IntPtr hwnd, HtmlElement visitItem) { Point p = GetOffset(visitItem); Size winSize = InitialTabBrowser.Document.Window.Size; InitialTabBrowser.Document.Window.ScrollTo(winSize.Width / 2, p.Y); p.Y -= InitialTabBrowser.Document.GetElementsByTagName("HTML")[0].ScrollTop; p.X += visitItem.OffsetRectangle.Width / 2; p.Y += visitItem.OffsetRectangle.Height / 2; InitialTabBrowser.Document.InvokeScript("simulate", new object[] { visitItem.Parent.DomElement, "click" }); //HtmlElement ele = InitialTabBrowser.Document.GetElementFromPoint(p); ClickOnPointInClient(hwnd, p); //ClientToScreen(hwnd, ref p); //Cursor.Position = new Point(p.X, p.Y); visitItem.InvokeMember("click"); //ClickOnPoint(hwnd, p); return true; }
protected void NavigateToSite(HtmlElement oLink, ref WebBrowser oBrowser) { CountedWait oCWTimer = new CountedWait(ref oBrowser, 3000); while (true) { try { sSiteToNavigate = oLink.GetAttribute("href"); oLink.InvokeMember("click"); if (oCWTimer.Wait(10)) { bSiteFound = true; TimedWait oTimedWait = new TimedWait(oRandomizer.Next(10000, 30000)); oTimedWait.Wait(); return; } else { //System.Console.WriteLine("Proxy timeout, switching to next one."); wininet.RefreshIEProxySettings(); } } catch (UnauthorizedAccessException ex) { throw new UnauthorizedAccessException("..::" + this.GetType().Name + "::..NavigateToSite thrown an exception", ex); } catch (AccessViolationException ex) { throw new AccessViolationException("..::" + this.GetType().Name + "::..NavigateToSite thrown an exception", ex); } catch (Exception ex) { System.Console.WriteLine("..::" + this.GetType().Name + "::..NavigateToSite thrown an exception, reason: " + ex.Message + ", switching proxy"); wininet.RefreshIEProxySettings(); } } }
protected void GoToNextPage(HtmlElement oLink, ref WebBrowser oBrowser) { CountedWait oCWTimer = new CountedWait(ref oBrowser, 3000); while (true) { try { // Below line added to rise UnauthorizedAccessException in case something went wrong String sHREF = oLink.GetAttribute("href"); oLink.InvokeMember("click"); if (oCWTimer.Wait(10)) { TimedWait oTimedWait = new TimedWait(oRandomizer.Next(8000, 14000)); oTimedWait.Wait(); return; } else { //System.Console.WriteLine("Proxy timeout, switching to next one."); wininet.RefreshIEProxySettings(); } } catch (UnauthorizedAccessException ex) { throw new UnauthorizedAccessException("Unauthorized access to HTML properties, aborting operation", ex); } catch (AccessViolationException ex) { throw new AccessViolationException("Access Violation, aborting operation", ex); } catch (Exception ex) { System.Console.WriteLine("..::" + this.GetType().Name + "::..GoToNextPage thrown an exception, reason: " + ex.Message + ", switching proxy"); wininet.RefreshIEProxySettings(); } } }
public void Over(HtmlElement h) { h.InvokeMember("fireEvent", new object[] { "onmouseover" }); }
public void MouseClick(HtmlElement h) { h.InvokeMember("fireEvent", new object[] { "onmouseclick" }); }
/// <summary> /// 快捷登录 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void wfBrowser_DocumentCompleted(object sender, System.Windows.Forms.WebBrowserDocumentCompletedEventArgs e) { //wfBrowser.Document.Body.Style = "overflow:hidden"; #region 控制网站根据窗体大小加载窗体大小 if (wfBrowser.ReadyState != WebBrowserReadyState.Complete) { return; } System.Drawing.Size szb = new System.Drawing.Size(wfBrowser.Document.Body.OffsetRectangle.Width, wfBrowser.Document.Body.OffsetRectangle.Height); System.Drawing.Size sz = (System.Drawing.Size)wfBrowser.Size; int xbili = (int)((float)sz.Width / (float)szb.Width * 100); //水平方向缩小比例 int ybili = (int)((float)sz.Height / (float)szb.Height * 100); //垂直方向缩小比例 wfBrowser.Document.Body.Style = "zoom:" + xbili.ToString() + "%"; wfBrowser.Invalidate(); #endregion #region 博客园登录 if (Common.instance.Apply == 1) { string BlogKey = "sadf";//加密博客园密码 string BlogDecrypt = Common.instance.DESCDecrypt(Common.instance.GetKey(), BlogKey); System.Windows.Forms.HtmlElement ClickBtn = null; if (e.Url.ToString().ToLower().IndexOf("/user/signin") > 0) { System.Windows.Forms.HtmlDocument doc = wfBrowser.Document; for (int i = 0; i < doc.All.Count; i++) { if (doc.All[i].TagName.ToUpper().Equals("INPUT")) { switch (doc.All[i].Id) { case "input1": doc.All[i].InnerText = "sdf"; // 用户名 break; case "input2": doc.All[i].InnerText = BlogDecrypt; // 密码 break; case "signin": ClickBtn = doc.All[i]; break; } } } ClickBtn.InvokeMember("Click"); // 点击“登录”按钮 } } #endregion #region 新浪微博登录 else if (Common.instance.Apply == 2) { string SinaKey = "123123";//加密新浪微博密码 string SinaDecrypt = Common.instance.DESCDecrypt(Common.instance.GetKey(), SinaKey); System.Windows.Forms.HtmlElement ClickBtn = null; if (e.Url.ToString().ToLower().IndexOf("/weibo.com") > 0) { System.Windows.Forms.HtmlDocument doc = wfBrowser.Document; for (int i = 0; i < doc.All.Count; i++) { if (doc.All[i].TagName.ToUpper().Equals("INPUT")) { switch (doc.All[i].TabIndex) { case 1: doc.All[i].InnerText = "sdf"; // 用户名 break; case 2: doc.All[i].InnerText = SinaDecrypt; // 密码 break; case 6: ClickBtn = doc.All[i]; break; } } } ClickBtn.InvokeMember("Click"); // 点击“登录”按钮 } } #endregion #region 网易邮箱登录 else if (Common.instance.Apply == 3) { string MailKey = "123";//加密网易邮箱密码 string MailDecrypt = Common.instance.DESCDecrypt(Common.instance.GetKey(), MailKey); System.Windows.Forms.HtmlElement ClickBtn = null; if (e.Url.ToString().ToLower().IndexOf("/mail.163.com") > 0) { System.Windows.Forms.HtmlDocument doc = wfBrowser.Document; for (int i = 0; i < doc.All.Count; i++) { if (doc.All[i].TagName.ToUpper().Equals("INPUT")) { switch (doc.All[i].TabIndex) { case 1: doc.All[i].InnerText = "sdf"; // 用户名 break; case 2: doc.All[i].InnerText = MailDecrypt; // 密码 break; case 8: ClickBtn = doc.All[i]; break; } } } ClickBtn.InvokeMember("Click"); // 点击“登录”按钮 } } #endregion }
public static void ClickHtmlElement(this WebBrowser browser, HtmlElement he) { he.InvokeMember("click"); }