Saturday, May 3, 2008

QTP - TextBox Length

I was going through EMOS Framework. I think that this framework has been developed in QuickTest Professional 6.5 There I have seen a function to find the text box length. Below I have given that code snippet, which is very simple.

Code:

Public Sub BrowserWebEdit (strWebEdit,strInValue) If strInValue <> "" Then 'Get Length of strInValue InLenCount = Len(strInValue) 'Get Max Length for input LenCount = Browser(strBrowser).Page(strPage).WebEdit(strWebEdit).GetROProperty ("max length") If InLenCount > LenCount Then If LenCount <> -1 Then 'Trim Length of input Reporter.ReportEvent micWarning, strInValue , InLenCount & ": Length exceeds field input value trimed to: " & LenCount strInValue = Left(strInValue, LenCount) End If End If Browser(strBrowser).page(strPage).Sync Browser(strBrowser).Page(strPage).WebEdit(strWebEdit).Set strInValue End If End Sub

2 comments:

Muthu said...

Hi Palani,

This is muthu from chennai(barath friend), am a QTP Tester, very helpful ur Vbscript for QTP,
first thanks u to ur valuable coding.

And do u know the code for exception handling to general pop up , system crash and object state changing and also for regular expressions in Vbscript especially QTP.

My bussiness id is : nzdkfc@eds.com

Thanks
Muthu - 9941557125

Palani Selvam said...

Muthu,
Thanks for the comments.

Develop a common function(s), it should close all the popups related to AUT and call into required actions.