vbscriptqtp

using WebEdit .Type property cannot be used


I have a piece of code in using QTP for a webpage

Browser("Sarit_2").Page("Sarit").WebEdit("frm_vendor_address1").Set dtVAdd1

You will observe, I used a 'Set' property. In reality, I wanted to use a 'Type' property because soon I will write script to check field limit and .Set property throws an error when I try to set a value larger than the field length. But Type property(I used it in win32 app), it types as much as the field length but at least doesn't throw an error I can't handle.

QTP in WebEdit or this particular WebEdit does not allow me to choose .Type. How come it allowed me in the case of SWFfield?

Any suggestions?


Solution

  • "Type" is a method used for Windows application, Delphi, Java, swf etc... But it is not used for Web application.

    For web application we have to use "Set" method. Therefore above piece of code accepts 'Set' method. This also tells why you can not use 'Type' method with web based object.

    If you want to count the field limit, you can object spy on the webedit-> save its max length value to any variable-> at run time store max length of that web edit field to variable2 using 'Browser("...").Page("..."). .... .GetROProperty("max length"). Now compare the two variable with if statement.