当前位置:编程学习 > C#/ASP.NET >>

C#网页自动填表单

 
[code=csharp]using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication9
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            #region
            HtmlElement queren = webBrowser1.Document.All["loginBtn"];
            HtmlElement yonghuming = webBrowser1.Document.All["txtUserName"];
            HtmlElement mima = webBrowser1.Document.All["txtPassword"];
            if (yonghuming == null || mima == null || queren == null)
                return;
            yonghuming.SetAttribute("value", "15917192524");
            mima.SetAttribute("value", "ok15917192524");
            queren.InvokeMember("click");
            #endregion 
        }
        private void button1_Click(object sender, EventArgs e)
        {
            webBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser1_DocumentCompleted);
            webBrowser1.Navigate("http://mail.10086.cn/");
        }
    }
}
自动填表单好后点登录弹出个安全警报即将重定向到不安全的连接,要点击该如何操作,查看不到网页源文件 C# 浏览器 --------------------编程问答-------------------- --------------------编程问答-------------------- 这跟IE设置有关
WebBrowser就是一个小型的IE,你看看控件里有没有相关的属性可以处理它 --------------------编程问答-------------------- 我就是不知道怎么处理才来求助的啊,帮帮忙 --------------------编程问答-------------------- 看看这个帖子:http://stackoverflow.com/questions/12221490/how-to-disable-security-warning-window-in-webbrowser-control --------------------编程问答-------------------- refer: http://bbs.csdn.net/topics/320132674
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,