QTP忽略输入字符数的限制

发布于 2024-11-23 23:22:24 字数 175 浏览 8 评论 0原文

我现在正在 QTP 中测试联合国网站。有一个接受 160 个字符的文本输入区域。使用QTP输入长文本时,不考虑限制,所有字符都显示在区域内。另外,该区域旁边有一条消息,通知剩余的字符数,并且该数字在 QTP 输入后从未改变。

所以我想知道是否有人已经研究过这个问题并可以给我一些建议。预先非常感谢。

艾伦

I'm working now in QTP to test un website. There is a text input area that accepts 160 charactors. When using QTP to input a long text, it doesn't regard the limit and all the charactors are displayed in the area. Also, there is a message beside the area to notify the number of charactors remained and this number never changed after the input by QTP.

So I'd like to know if someone has already worked on this issue and can give me some advices. Thanks a lot in advance.

Allen

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

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

发布评论

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

评论(2

云之铃。 2024-11-30 23:22:24

正如 Tom 所说,造成这种情况的原因可能是 QTP 直接设置值,但是 WebEdit 不支持 Type,因此您必须尝试其他方法。

为了让 QTP 更精确地模拟用户操作,您可以尝试切换到设备重放模式(如我的 在这里回答

Setting.WebPackage("ReplayType") = 2 ' device replay
Browser(X).Page(Y).WebEdit(Z).Set "Some text"
Setting.WebPackage("ReplayType") = 1 ' return to event replay

As Tom said the cause for this is probably that QTP is setting the value directly, however a WebEdit doesn't support Type so you must try something else.

In order to have QTP simulate user actions more precisely you can try switching to device replay mode (as described in my answer here)

Setting.WebPackage("ReplayType") = 2 ' device replay
Browser(X).Page(Y).WebEdit(Z).Set "Some text"
Setting.WebPackage("ReplayType") = 1 ' return to event replay
绻影浮沉 2024-11-30 23:22:24

默认的记录/播放机制可能是直接设置文本字段的文本属性,而不是用键盘模拟用户输入。

如果您的测试围绕验证用户不能在该字段中输入超过 160 个字符,则您将需要调整 QTP 脚本来模拟击键。您将需要在文本字段上使用 Type 方法。

The default record/playback mechanism is likely setting the text property of the text field directly, rather than simulating user input with the keyboard.

If your test revolves around verifying that a user cannot enter more than 160 chars in that field, you will need to tweak the QTP script to simulate keystrokes instead. You will want to use the Type method on the text field.

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