我就是作自动测试软件的.但是东西是公司的 :)在www.codeproject.com上面有一个简单的,大约能符合你的要求,好像是一个清华的(或者北大)的什么人写的.自己找找看.

解决方案 »

  1.   

    http://www.csharptoday.com/content.asp?id=1980&csharp0161
      

  2.   

    TheAres(班门斧)
    英文的好难找,我没有找到,帮我找一下吧.
    谢谢!!!
    分数要多少我再加!
      

  3.   

    TheAres(班门斧)
    能讲一下大致的编程思路吗?
    我试了一种方法可是不太顺利,我的方法是这样的:
    1.Aximp c:\winnt\system32\shdocvw.dll 
    运行上述命令,产生“SHDocVw.dll”和“AxSHDocVw.dll”二个文件
    2.将AxSHDocVw.dll引用到C#项目中.
    3.AxSHDocVw.AxWebBrowser axWebBrowser1
    生成一个流览器.
    我目前进行到这一步,可以弹出一个自己的流览器,
    我想抓住流览器中的组件(例如:input,select等),可是没办法抓到,
    如果能够抓到这些组件,就能够得到他们的值,并记录下来,可能就能够实现了,
    我不知道这样的思路是否正确.希望你能够指点一下.
      

  4.   

    http://www.codeproject.com/tools/WebTester.asp
      

  5.   

    Please have a look at the atricel in the CodeProject.可以通过重载webbrowser control的IDocHostUIHandler接口来接收用户在html页面上的操作,给你点源代码,c#的 凑合着看吧namespace WindowsApplication5
    {
    ///
    /// Summary description for Form1.
    ///
    ///
    [Serializable]
    public class Form1 : System.Windows.Forms.Form ,IDocHostUIHandler
    {
    private AxSHDocVw.AxWebBrowser WebBrowser;
    private System.Windows.Forms.Button button1;
    ///
    /// Required designer variable.
    ///
    private System.ComponentModel.Container components = null;public Form1()
    {
    //
    // Required for Windows Form Designer support
    //
    InitializeComponent();//
    // TODO: Add any constructor code after InitializeComponent call
    //
    this.WebBrowser.DocumentComplete += new DWebBrowserEvents2_DocumentCompleteEventHandler(this.WebBrowser_DocumentComplete);
    object flags = 0;
    object targetFrame = String.Empty;
    object postData = String.Empty;
    object headers = String.Empty;
    this.WebBrowser.Navigate("about:blank", ref flags, ref targetFrame, ref postData, ref headers);ICustomDoc cDoc = (ICustomDoc)this.WebBrowser.Document;
    cDoc.SetUIHandler((IDocHostUIHandler)this);this.WebBrowser.Navigate(@"XXXX.htm", ref flags, ref targetFrame, ref postData, ref headers);
    }///
    /// Clean up any resources being used.
    ///
    protected override void Dispose( bool disposing )
    {
    if( disposing )
    {
    if (components != null)
    {
    components.Dispose();
    }
    }
    base.Dispose( disposing );
    }#region Windows Form Designer generated code
    ///
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    ///
    private void InitializeComponent()
    {
    System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
    this.WebBrowser = new AxSHDocVw.AxWebBrowser();
    this.button1 = new System.Windows.Forms.Button();
    ((System.ComponentModel.ISupportInitialize)(this.WebBrowser)).BeginInit();
    this.SuspendLayout();
    //
    // WebBrowser
    //
    this.WebBrowser.Enabled = true;
    this.WebBrowser.Location = new System.Drawing.Point(72, 32);
    this.WebBrowser.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("WebBrowser.OcxState")));
    this.WebBrowser.Size = new System.Drawing.Size(300, 150);
    this.WebBrowser.TabIndex = 0;
    //
    // button1
    //
    this.button1.Location = new System.Drawing.Point(232, 152);
    this.button1.Name = "button1";
    this.button1.TabIndex = 1;
    this.button1.Text = "button1";
    this.button1.Click += new System.EventHandler(this.button1_Click);
    //
    // Form1
    //
    this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
    this.ClientSize = new System.Drawing.Size(384, 197);
    this.Controls.AddRange(new System.Windows.Forms.Control[] {
    this.button1,
    this.WebBrowser});
    this.Name = "Form1";
    this.Text = "Form1";
    this.Load += new System.EventHandler(this.Form1_Load);
    ((System.ComponentModel.ISupportInitialize)(this.WebBrowser)).EndInit();
    this.ResumeLayout(false);}
    #endregion///
    /// The main entry point for the application.
    ///
    [STAThread]
    static void Main()
    {
    Application.Run(new Form1());
    }
    private void WebBrowser_DocumentComplete(object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
    {
    IHTMLDocument2 doc = (IHTMLDocument2)this.WebBrowser.Document;
    HTMLButtonElement button = (HTMLButtonElement)doc.all.item("theButton", null);
    HTMLButtonElement button1 = (HTMLButtonElement)doc.all.item("theButton1", null);
    HTMLButtonElement button2 = (HTMLButtonElement)doc.all.item("theButton2", null);
    ((HTMLButtonElementEvents2_Event)button).onclick += new HTMLButtonElementEvents2_onclickEventHandler(this.Button_onclick);
    ((HTMLButtonElementEvents2_Event)button1).onclick += new HTMLButtonElementEvents2_onclickEventHandler(this.Button1_onclick);
    ((HTMLButtonElementEvents2_Event)button2).onclick += new HTMLButtonElementEvents2_onclickEventHandler(this.Button2_onclick);
    }private bool Button_onclick(IHTMLEventObj e)
    {
    MessageBox.Show("Alert from the app: Received theButton.onclick!");
    return true;
    }
    private bool Button1_onclick(IHTMLEventObj e)
    {
    MessageBox.Show("Alert from the app: Received theButton1.onclick!");
    return true;
    }
    private bool Button2_onclick(IHTMLEventObj e)
    {
    MessageBox.Show("Alert from the app: Received theButton2.onclick!");
    return true;
    }// IDocHostUIHandler implementationvoid IDocHostUIHandler.EnableModeless(int fEnable)
    {}void IDocHostUIHandler.FilterDataObject(MsHtmHstInterop.IDataObject pDO, out MsHtmHstInterop.IDataObject ppDORet)
    {
    ppDORet = null;
    }void IDocHostUIHandler.GetDropTarget(IDropTarget pDropTarget, out IDropTarget ppDropTarget)
    {
    ppDropTarget = null;
    }void IDocHostUIHandler.GetExternal(out object ppDispatch)
    {
    ppDispatch = null;
    }void IDocHostUIHandler.GetHostInfo(ref _DOCHOSTUIINFO pInfo)
    {}void IDocHostUIHandler.GetOptionKeyPath(out string pchKey, uint dw)
    {
    pchKey = null;
    }void IDocHostUIHandler.HideUI()
    {}void IDocHostUIHandler.OnDocWindowActivate(int fActivate)
    {}void IDocHostUIHandler.OnFrameWindowActivate(int fActivate)
    {}void IDocHostUIHandler.ResizeBorder(ref MsHtmHstInterop.tagRECT prcBorder, IOleInPlaceUIWindow pUIWindow, int fRameWindow)
    {}void IDocHostUIHandler.ShowContextMenu(uint dwID, ref MsHtmHstInterop.tagPOINT ppt, object pcmdtReserved, object pdispReserved)
    {}void IDocHostUIHandler.ShowUI(uint dwID, IOleInPlaceActiveObject pActiveObject, IOleCommandTarget pCommandTarget, IOleInPlaceFrame pFrame, IOleInPlaceUIWindow pDoc)
    {}void IDocHostUIHandler.TranslateAccelerator(ref tagMSG lpmsg, ref Guid pguidCmdGroup, uint nCmdID)
    {}void IDocHostUIHandler.TranslateUrl(uint dwTranslate, ref ushort pchURLIn, IntPtr ppchURLOut)
    {}void IDocHostUIHandler.UpdateUI()
    {}
    private void Form1_Load(object sender, System.EventArgs e)
    {}private void button1_Click(object sender, System.EventArgs e)
    {}
    }
    }
      

  6.   

    找不到类型或命名空间名称“IDocHostUIHandler”(是否缺少 using 指令或程序集引用?)