WatiN SelectList 方法 - 与选择列表交互后页面未刷新/操作未触发

发布于 2024-08-29 15:01:07 字数 552 浏览 1 评论 0原文

前言:

如果您不关心前言,请跳至标有“问题”的部分。

您好,

最近我公司的测试自动化框架已升级到最新版本的 WatiN。我们进行了升级以避免与选择列表交互会导致 ACCSES DENIED 错误的问题。此错误似乎是由于以下事实造成的:在选择某些选择列表选项后,我们的 Web 应用程序会使用新字段重新加载其所在页面(位于框架集中的框架中)。也可能是我们的框架(围绕 WatiN)经常在页面刷新后对同一个 SelectList 执行操作(我仍在研究这一点,我是该框架的新手)。

新版本的 WatiN 确实解决了 ACCESS DENIED 错误,但似乎也阻止了选择列表触发导致页面重新加载新选项的操作。事实上,如果您使用 WatiN 进行选择,选择列表将无法正常工作,即使手动交互,直到页面被强制刷新。

问题:

当使用最新的 WatiN 代码在 SelectList 中选择选项时,导致我们的 Web 应用程序页面重新加载新字段/值的事件不会执行。可能导致这种情况的可能性有哪些?

我见过最常用于描述使用选择列表时发生的刷新的术语是“双重回发”。

非常感谢, 乍得

Preface:

If you don't care about the preface, skip down to the section marked "Question."

Hi,

Recently my company has upgraded to the latest version of WatiN for its test automation framework. We upgraded to avoid a problem where interacting with a select list would cause an ACCSES DENIED error. This error seems to be a product of the fact that our web application reloads the page it is on (which sits in a frame which sits in a frameset) with new fields after certain select lists options are selected. It could also be that our framework, which wraps around WatiN, often does actions on the same SelectList after the page refresh (I'm still looking into this, I'm new to the framework).

The new version of WatiN does solve the ACCESS DENIED error, but also seems to stop select lists from firing the action that causes the page to reload w/ its new options. In fact, if you use WatiN to make the selection, the select list won't work correctly, even if manually interacted with, until the page has been forced to refresh.

Question:

When selecting an option in a SelectList using the newest WatiN code, the event that causes our web app's page to reload with new fields/values does not execute. What are some possibilities that could cause this?

The term i've seen used most often to describe the refreshing that occurs when our select lists are used is "double post-back".

Many thanks,
Chad

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

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

发布评论

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

评论(1

梦途 2024-09-05 15:01:07

这是新 WatiN 代码的一部分。如果您查看 SelectList 类,新代码会包含有关它已更改的注释,以便这些事件不会完全触发。它说的是“您可能需要使用按键或其他事件来获取选择列表来触发其事件”。

这对我来说不起作用,所以我们回到了旧代码。

有用的一件事是使用 try/catch(System.UnauthorizedAccess e) 包装对选择列表的调用,然后对选择列表对象执行 .Refresh。之后,可以重试该调用,并且看起来效果很好。

This is part of the new WatiN code. The new code, if you look into the SelectList class has comments about the fact that it has been changed so that these events don't exactly fire. It says something along the lines of "you may need to use a key press or other event to get a select list to fire its events".

This didn't work for me so we went back to the old code.

One thing that has helped is wrapping calls to the select list w/ a try/catch(System.UnauthorizedAccess e) and then doing a .Refresh on the select list object. Afterwards, the call can be retried and it seems to work pretty well.

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