C# 不能';t使用browser.attachto<;FireFox>;WatiN 2.0 RC1中的方法

C# 不能';t使用browser.attachto<;FireFox>;WatiN 2.0 RC1中的方法,c#,firefox,browser,watin,C#,Firefox,Browser,Watin,我正在使用HTTPWatch自动化API启动一个新的Firefox实例,如下所示: HttpWatch.Controller ct = new HttpWatch.Controller(); HttpWatch.Plugin plugin = ct.FireFox.New(""); plugin.GotoURL("http://www.google.com"); 这些代码可以成功启动Firefox浏览器。然后我想在WatiN 2.0中控制浏览器: FireFox ff = Browser.At

我正在使用HTTPWatch自动化API启动一个新的Firefox实例,如下所示:

HttpWatch.Controller ct = new HttpWatch.Controller();
HttpWatch.Plugin plugin = ct.FireFox.New("");
plugin.GotoURL("http://www.google.com");
这些代码可以成功启动Firefox浏览器。然后我想在WatiN 2.0中控制浏览器:

FireFox ff = Browser.AttachTo<FireFox>(Find.ByTitle("Google"));
FireFox ff=Browser.AttachTo(Find.ByTitle(“谷歌”);
WatiN找不到Firefox窗口(Firefox中添加了JSSH插件)。但是在IE7上进行同样的测试是可以的

我甚至尝试手动打开Firefox窗口并访问google.com页面。IE7中的WaitN可以连接到浏览器,但Firefox失败

我的密码有什么问题吗?或者其他建议?提前谢谢

以下是我的环境的配置:

  • 操作系统:Windows XP Pro SP2
  • WatiN:2.0 RC1
  • 浏览器:IE 7、Firefox 3.0/3.5/3.6和JSSH插件
需要检查两件事:

首先,据我所知,2.0 RC1中的call Browser.AttachTo似乎已损坏。它可以替换为以下内容:

FireFox ff = (FireFox)Browser.AttachTo(typeof(FireFox),Find.ByTitle("Google"));
如果您使用Firefox 3.6,您可能需要更新JSSH插件,WatiN 2.0 RC1二进制文件中包含的插件与它不兼容


可以在这里找到:

谢谢你的评论,我从你提供的与Firefox3.6相匹配的站点更新了JSSH插件。但是在WatiN 3.0 RC1和Beta1中找不到函数FireFox.AttachToFireFox()。我使用HttpWatch提供的attach方法来控制Firefox浏览器:

HttpWatch.Controller ct = new HttpWatch.Controller();
HttpWatch.Plugin plugin = controller.Firefox.Attach("Default");
它起作用了!但是…HttpWatch提供的附加方法不适用于IE

HttpWatch.Controller ct = new HttpWatch.Controller();
HttpWatch.Plugin plugin = ct.IE.Attach((SHDocVw.IWebBrowser2)ie.InternetExplorer);
上面的代码引发如下异常:

HttpWatch.Controller ct = new HttpWatch.Controller();
HttpWatch.Plugin plugin = ct.FireFox.New("");
plugin.GotoURL("http://www.google.com");
无法加载文件或程序集 'Interop.SHDocVw,版本=1.1.0.0, 文化=中立, PublicKeyToken=db7cfd3acb5ad44e'或 它的一个依赖项。位于 程序集的清单定义不正确 与程序集引用不匹配。 (来自HRESULT的异常:0x8013100)


很难让WatiN 2.0和HttpWatch一起工作….

最近进行了一项突破性的更改,使WatiN浏览器不可知,并允许测试人员创建一个浏览器文本装置,在指定浏览器上运行测试,而无需专门内联编码

一旦找到代码,我会发布一些更具体的东西;我改变了任务,现在与TFS 2010合作,而不是WatiN(不是我的选择,我爱WatiN!)