QTP ignores the limit of numbers of input charactors

坚强是说给别人听的谎言 提交于 2019-12-11 04:35:27

问题


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


回答1:


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



回答2:


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.



来源:https://stackoverflow.com/questions/6665589/qtp-ignores-the-limit-of-numbers-of-input-charactors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!