C# 如何控制 打开的ie网页 插入填写信息
解决重酬!!
例如
1条回答
- threenewbee 2019-02-23 23:28关注
https://ask.csdn.net/questions/749719 采纳后帮你写一个。
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(); } } }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 孟德尔随机化结果不一致
- ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
- ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
- ¥15 谁有desed数据集呀
- ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
- ¥15 关于#hadoop#的问题
- ¥15 (标签-Python|关键词-socket)
- ¥15 keil里为什么main.c定义的函数在it.c调用不了
- ¥50 切换TabTip键盘的输入法
- ¥15 可否在不同线程中调用封装数据库操作的类