首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Watin和HttpWatch编译错误?

Watin和HttpWatch编译错误?
EN

Stack Overflow用户
提问于 2011-07-24 20:45:37
回答 1查看 428关注 0票数 0

我正在尝试让下面的代码同时使用Watin和HttpWatch。

我得到一个编译错误‘类型或命名空间'IEBrowser’找不到(您是否缺少using指令或程序集引用?)

我引用了HttpWatch、Interop.SHDocVw、WatiN.Core和Microsoft.mshtml。我不确定还有什么地方不对劲?

下面的代码是我使用的代码,取自http://blog.httpwatch.com/2008/10/30/using-httpwatch-with-watin/

我真的需要让Watin和HttpWatch在同一个项目中协同工作,这样我才能监控服务器性能。

谢谢!

代码语言:javascript
复制
using System;
using System.Collections.Generic;
using System.Text;
using WatiN.Core;

namespace WatiN
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            // Open a new Internet Explorer window and
            // goto the google website.
            IE ie = new IE("http://www.google.com");

            // Attach HttpWatch to this new instance of IE
            HttpWatch.Controller ct = new HttpWatch.Controller();

            // the below line was supposedly for Watin 1.3
            //HttpWatch.Plugin plugin = ct.IE.Attach((SHDocVw.IWebBrowser2)ie.InternetExplorer);

            // the below line is for Watin 2.x
            HttpWatch.Plugin plugin = ct.IE.Attach((IEBrowser)ie.NativeBrowser).WebBrowser;

            // Start recording a log file in HttpWatch
            plugin.Record();

            // Find the search text field and type Watin in it.
            ie.TextField(Find.ByName("q")).TypeText("WatiN");

            // Click the Google search button.
            ie.Button(Find.ByValue("Google Search")).Click();
            ie.WaitForComplete();

            // Stop recording and save an HttpWatch log file
            plugin.Stop();
            plugin.Log.Save(@"c:\mydir\googlesearch.hwl");

            HttpWatch.Summary logSummary = plugin.Log.Entries.Summary;

            Console.WriteLine("\r\nElapsed time (secs) = " + logSummary.Time.ToString() +
                              " Downloaded bytes = " + logSummary.BytesReceived.ToString());

            // Uncomment the following line if you want to close
            // Internet Explorer and the console window immediately.
            //ie.Close();
        }
    }
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-06-26 16:50:28

HttpWatch现在提供了一个示例程序,向您展示如何在HttpWatch中使用WatiN 2.1:

http://blog.httpwatch.com/2012/06/25/using-httpwatch-and-watin-2-1/

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6806869

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档