Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use WebKit.DOM.Element

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces "how to use WebKit.DOM.Element". In daily operation, I believe many people have doubts about how to use WebKit.DOM.Element. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to use WebKit.DOM.Element"! Next, please follow the editor to study!

Using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;namespace WebConnect {public partial class Form1: Form {public Form1 () {InitializeComponent ();} public string LastUrl {set; get } private void Form1_Load (object sender, EventArgs e) {webKitBrowser1.Navigate ("http://192.168.149.1/ArasMVC01/Login"); webKitBrowser1.DocumentCompleted + = SetArasLogin") } private void webKitBrowser1_Load (object sender, EventArgs e) {} private void webKitBrowser1_DocumentCompleted (object sender, WebBrowserDocumentCompletedEventArgs e) {} private void SetArasLogin (object sender, WebBrowserDocumentCompletedEventArgs e) {if (webKitBrowser1.Url.ToString () = = LastUrl) return; if (e.Url.ToString ()! = DocCompleteUrl.Login) return LastUrl = webKitBrowser1.Url.ToString (); List loginTag = new List () {"ip", "db", "admin", "pwd"}; List loginInfo = new List () {"http://192.168.149.1/plm"," InnovatorSolutions "," admin "," innovator "}; for (int I = 0; I < loginInfo.Count ()) WebKit.DOM.Element element +) {WebKit.DOM.Element element = webKitBrowser1.Document.GetElementById (logintag [I]); element.SetAttribute ("value", loginInfo [I]);} webKitBrowser1.StringByEvaluatingJavaScriptFromString ("document.getElementById ('loginSubmit'). Click ();"); webKitBrowser1.DocumentCompleted + = RunDocumentCompleted; / / webKitBrowser1.Navigate (DocCompleteUrl.AdminSearch) } private void RunDocumentCompleted (object sender, WebBrowserDocumentCompletedEventArgs e) {if (e.Url.ToString ()! = DocCompleteUrl.AdminSearch) {webKitBrowser1.Navigate (DocCompleteUrl.AdminSearch); webKitBrowser1.DocumentCompleted + = AdminSearchCompleted }} private void AdminSearchCompleted (object sender, WebBrowserDocumentCompletedEventArgs e) {if (webKitBrowser1.Url.ToString () = = LastUrl) return; if (e.Url.ToString ()! = DocCompleteUrl.AdminSearch) return; webKitBrowser1.Document.GetElementById ("btnGetNumber") .SetAttribute ("type", "hidden") } private void button1_Click (object sender, EventArgs e) {MessageBox.Show (webKitBrowser1.Document.GetElementById ("seq") .TextContent);}} public class DocCompleteUrl {public static string Login {set; get;} = "http://192.168.149.1/ArasMVC01/Login"; public static string AdminSearch {set; get" } = "http://192.168.149.1/ArasMVC01/AdminSearch";}} at this point, the study on" how to use WebKit.DOM.Element "is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report