QTP忽略输入字符数的限制
我现在正在 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如 Tom 所说,造成这种情况的原因可能是 QTP 直接设置值,但是
WebEdit
不支持Type
,因此您必须尝试其他方法。为了让 QTP 更精确地模拟用户操作,您可以尝试切换到设备重放模式(如我的 在这里回答)
As Tom said the cause for this is probably that QTP is setting the value directly, however a
WebEdit
doesn't supportType
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)
默认的记录/播放机制可能是直接设置文本字段的文本属性,而不是用键盘模拟用户输入。
如果您的测试围绕验证用户不能在该字段中输入超过 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.