访问网页并自动填写表单
2016-02-05 16:46
459 查看
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 webfullform
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
}
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
HtmlDocument htmlDoc = webBrowser1.Document;
HtmlElement ImageButton1 = htmlDoc.All["ImageButton1"];
HtmlElement txAccount = webBrowser1.Document.All["txAccount"];
HtmlElement txPwd = webBrowser1.Document.All["txPwd"];
if (ImageButton1 != null)
{
txAccount.SetAttribute("value", "wlq");
txPwd.SetAttribute("value", "wlq");
//ImageButton1.InvokeMember("click");
//btnElement.AttachEventHandler("onclick", new EventHandler(HtmlBtnClose_Click));
}
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace webfullform
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
}
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
HtmlDocument htmlDoc = webBrowser1.Document;
HtmlElement ImageButton1 = htmlDoc.All["ImageButton1"];
HtmlElement txAccount = webBrowser1.Document.All["txAccount"];
HtmlElement txPwd = webBrowser1.Document.All["txPwd"];
if (ImageButton1 != null)
{
txAccount.SetAttribute("value", "wlq");
txPwd.SetAttribute("value", "wlq");
//ImageButton1.InvokeMember("click");
//btnElement.AttachEventHandler("onclick", new EventHandler(HtmlBtnClose_Click));
}
}
}
}
相关文章推荐
- MongoDB自动增长id实现、自定义函数调用、与Spring集成
- mongoose 文档(三) Documents
- [转载] 编程每一天(Write Code Every Day)
- 端口相关
- win7系统的IIS6与Frameworks2配置
- ALSA和OSS编程示例
- [7] CMake总结 - 4 INSTALL
- dubbo+zookeeper简单环境搭建
- 基于net.tcp的WCF配置实例解析
- *Firefox*的*Firebug*进行JavaScript调试
- TCP,IP,HTTP,SOCKET区别讲解
- 我所知道的CallbackContract in WCF
- AIM Tech Round (Div. 2)C - Graph and String(二分图染色)
- 利用WCF的Duplex服务向Winform程序推送消息
- iOS APP提交上架最新流程(转)
- WCF关于客户端在线状态的处理
- POJ 2991 线段树
- UWP的拖拽功能
- WCF心跳判断服务端及客户端是否掉线并实现重连接
- eclipse颜色配置