无法使用 WatiN 2.0 RC1 中的 Browser.AttachTo方法附加到 Firefox 3.x 浏览器

发布于 2024-08-25 08:32:37 字数 690 浏览 3 评论 0原文

我正在使用 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"));

WatiN找不到Firefox窗口(Firefox中已添加JSSH插件)。但在IE 7上同样测试是可以的。

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

我的代码有什么问题吗?或者还有其他建议吗?提前致谢!

这是我的环境的配置:

  • 操作系统:Windows XP Pro SP2
  • WatiN:2.0 RC1
  • 浏览器:IE 7,带有 JSSH 插件的 Firefox 3.0/3.5/3.6

I am using HTTPWatch automation API to launch a new Firefox instance like that:

HttpWatch.Controller ct = new HttpWatch.Controller();
HttpWatch.Plugin plugin = ct.FireFox.New("");
plugin.GotoURL("http://www.google.com");

These codes could start a Firefox browser successfully. Then I want to control the browser in WatiN 2.0:

FireFox ff = Browser.AttachTo<FireFox>(Find.ByTitle("Google"));

WatiN could not find Firefox window (JSSH plugin has been added in Firefox). But the same test on IE 7 is ok.

I even tried to open a Firefox window manually and visit google.com page. WaitN in IE7 could attach to the browser, but Firefox failed.

Is there anything wrong with my codes? Or any other advice? Thanks in advance!

Here is the config for my environment:

  • OS: Windows XP Pro SP2
  • WatiN: 2.0 RC1
  • Browser: IE 7, Firefox 3.0/3.5/3.6 with JSSH plugin

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

守望孤独 2024-09-01 08:32:37

需要检查两件事:

首先,据我所知,Browser.AttachTo 调用似乎在 2.0 RC1 中被破坏。它可以替换为以下内容:

FireFox ff = (FireFox)Browser.AttachTo(typeof(FireFox),Find.ByTitle("Google"));

另外,如果您使用 Firefox 3.6,您可能需要更新您的 JSSH 插件,WatiN 2.0 RC1 二进制文件中包含的插件与其不兼容。

可以在这里找到: http://wiki.openqa.org/display/WTR/ FireWatir+安装

Two things to check:

First the call Browser.AttachTo seem to be broken in 2.0 RC1 as far as I know. It can be replace with something like:

FireFox ff = (FireFox)Browser.AttachTo(typeof(FireFox),Find.ByTitle("Google"));

Also you may need to update your JSSH plugin if you use Firefox 3.6, the one included with the WatiN 2.0 RC1 binary was not compatible with it.

It can be found here : http://wiki.openqa.org/display/WTR/FireWatir+Installation

永不分离 2024-09-01 08:32:37

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

HttpWatch.Controller ct = new HttpWatch.Controller();
HttpWatch.Plugin plugin = controller.Firefox.Attach("Default");

有效!但是......HttpWatch提供的attach方法不适用于IE,

HttpWatch.Controller ct = new HttpWatch.Controller();
HttpWatch.Plugin plugin = ct.IE.Attach((SHDocVw.IWebBrowser2)ie.InternetExplorer);

上面的代码抛出了这样的异常:

无法加载文件或程序集
'Interop.SHDocVw,版本=1.1.0.0,
文化=中立,
PublicKeyToken=db7cfd3acb5ad44e' 或
它的依赖项之一。位于的
程序集的清单定义确实
与装配参考不匹配。
(HRESULT 异常:0x80131040)

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

Thanks Vaudry, I updated JSSH plugin from the site you gave for matching Firefox3.6. But the function FireFox.AttachToFireFox() couldn't be found in WatiN 3.0 RC1 and Beta1. I used the attach method provided by HttpWatch to control the Firefox browser:

HttpWatch.Controller ct = new HttpWatch.Controller();
HttpWatch.Plugin plugin = controller.Firefox.Attach("Default");

It works! But....the attach method provided by HttpWatch is not working for IE,

HttpWatch.Controller ct = new HttpWatch.Controller();
HttpWatch.Plugin plugin = ct.IE.Attach((SHDocVw.IWebBrowser2)ie.InternetExplorer);

Above code throws an exception like that:

Could not load file or assembly
'Interop.SHDocVw, Version=1.1.0.0,
Culture=neutral,
PublicKeyToken=db7cfd3acb5ad44e' or
one of its dependencies. The located
assembly's manifest definition does
not match the assembly reference.
(Exception from HRESULT: 0x80131040)

So difficult to let WatiN 2.0 and HttpWatch work together....

半仙 2024-09-01 08:32:37

最近进行的一项重大更改使 WatiN 与浏览器无关,并允许测试人员创建一个浏览器文本固定装置,该固定装置将在指定的浏览器上运行测试,而无需专门进行内联编码。

找到代码后,我会发布更具体的内容;我更改了任务,现在使用 TFS 2010 而不是 WatiN(不是我的选择,我喜欢 WatiN!)。

A breaking change was made recently that made WatiN browser-agnostic and allows testers to create a browser text fixture that will run the tests on the specified browser without having to code it specifically inline.

I'll post something a little more specific once I locate the code; I changed assignments and now am working with TFS 2010 instead of WatiN (not my choice, I love WatiN!).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文