111,129
社区成员
发帖
与我相关
我的任务
分享



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 网页填表测试
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btn_OpenLogin_Click(object sender, EventArgs e)
{
webBrw_Html.Navigate(new Uri("网址"));
}
private void btn_Insert_Click(object sender, EventArgs e)
{
try
{
MessageBox.Show(webBrw_Html.Url.ToString());
}
catch
{
}
//框架名:mrightFrame //ctl00_ContentPlaceHolder1_Login1_txtUsr//txtTitle
try
{
// tbUserid.SetAttribute("value", "汪汪汪");
//webBrowser1.Document.Window.Frames["mrightFrame"].Document.GetElementById("txtTitle").SetAttribute("value", "1234");
webBrowser1.Document.All["Mothername"].SetAttribute("value", "王王王");
// webBrowser1.Document.Forms["Mothername"].GetElementsByTagName("ctl00_ContentPlaceHolder1_Login1_txtUsr")[0].InnerText = "pns";
webBrowser1.Document.All["Mothername"].SetAttribute("value", "王王王");
webBrowser1.Document.All["Mothername"].SetAttribute("value", "王王王");
webBrowser1.Document.GetElementById("Mothername").SetAttribute("value", "王王王");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void webBrw_Html_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
if (e.Url.ToString() == "网址")//检测当前网址是否是正确网址
{
MessageBox.Show("正确");
webBrowser1.Visible = true;
webBrowser1.Navigate("网址");
}
}
private void button1_Click(object sender, EventArgs e)//直接访问div网址
{
webBrw_Html.Navigate(new Uri("网址"));
}
}
}
