例如单击按钮 搜索框内 自动填写
主要用于 自动其他网页快速自动填写登录信息
https://blog.csdn.net/lgjlry/article/details/3460189
类似这个思路,把google换成baidu
如果需要一个C#自动搜索百度的例子,采纳了可以帮你写一遍。
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;
using System.Diagnostics;
using System.Threading;
using SHDocVw;
namespace Q749719
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
SHDocVw.InternetExplorer ie;
private void button1_Click(object sender, EventArgs e)
{
ie = new SHDocVw.InternetExplorer();
ie.DocumentComplete += new SHDocVw.DWebBrowserEvents2_DocumentCompleteEventHandler(ie_DocumentComplete);
complete = false;
ie.Navigate("http://www.baidu.com");
ie.Visible = true;
while (!complete)
{
Application.DoEvents();
Thread.Sleep(1000);
}
}
bool complete = false;
private void button2_Click(object sender, EventArgs e)
{
var doc = ie.Document;
doc.getElementById("kw").innerText = textBox1.Text;
}
void ie_DocumentComplete(object pDisp, ref object URL)
{
complete = true;
}
private void button3_Click(object sender, EventArgs e)
{
var doc = ie.Document;
doc.getElementById("su").click();
}
}
}
doc.getElementById("kw").innerText = textBox1.Text; 提示object不包含getElementByld的定义