尝试在 .NET Framework 4.0 测试项目中使用 WatiN 时需要注意哪些具体问题?

发布于 2024-09-10 20:10:53 字数 442 浏览 2 评论 0原文

我的情况是这样的:我有一个 ASP.NET Web 应用程序,我想为其实现测试。当我最初尝试 WatiN 时,我能够让 Google 搜索示例正常工作,并进行了一个小测试Web 应用程序的页面。但是,一旦我将 WatiN 组件添加到搁置集中以便同事可以尝试我的测试,WatiN 就停止在我的机器上工作。

我没有成功运行测试,而是得到如下异常:

WatiN.Core.Exceptions.WatiNException:元素在 30 秒内不可用。

WatiN 现在似乎唯一要做的就是使用我硬编码的 URL 启动浏览器。如果您有任何有关如何使其能够再次与 .NET Framework 4.0 一起工作的建议,我们将不胜感激。

My situation is this: I have an ASP.NET web application that I want to implement tests for. When I initially tried WatiN, I was able to get the Google search example working, and a small test for one of the pages of the web application. But once I added the WatiN assemblies to a shelveset so a co-worker could try out my tests, WatiN stopped working on my machine.

Instead of successfully running tests, I get exceptions like this one:

WatiN.Core.Exceptions.WatiNException: Element wasn't available within 30 seconds.

The only thing WatiN seems to do right now is launch the browser with the URLs I've hard-coded. Any suggestions on what to do in order to get this working with .NET Framework 4.0 again would be greatly appreciated.

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

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

发布评论

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

评论(1

余罪 2024-09-17 20:10:53

使用 Framwework 4.0 或其他版本并不会真正改变任何东西,最终,无论您使用哪种语言构建页面,WatiN 都会与 UI 配合使用。

但是,如果您的页面性能有点慢,或者您的表单有很多控件(这很常见),WatiN 通常会变得有点慢,因此您需要将超时设置为超过 30 秒。

我想您需要检查/使用等待的方法,例如 ie.WaitUntilContainsText("text", timeOut) &设置超时的其他方法..

顺便说一句,我刚刚在这里也遇到了类似的问题,您可能需要检查它

在 TFS 构建过程中运行 WatiN 测试出现超时问题

Working on Framwework 4.0 or else doesn't really change anything, at the end of the day WatiN works with the UI no matter what language you're building your page with..

Yet, if your page performance is a bit slow, or your forms have lots of controls (that's pretty usual), WatiN usually becomes a bit slow in doing thing, so you need to set the timeout to more than 30 sec.

I guess you need check/use methods that wait, for eg ie.WaitUntilContainsText("text", timeOut) & other methods that set its timeout..

btw I just ran also into a similar question here, you might wat to check it

Timeout problem running WatiN tests as part of TFS build

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