Highlighted
Valued Contributor.. Valued Contributor..
Valued Contributor..
172 views

Get character Value of field

I am entering 21 characters into an input field. I want to get the total characters entered if its less 20 or more 20.

I set Field A to enter 21 characters:

Browser("A").Page("A").WebEdit("Number Input").Set "123456789012345678900"

Dim Count, LenCount

Tried this line first:

LenCount = Browser("A").Page("A").WebEdit("Number Input").GetROProperty("max length")

Returned value= 524288

but it should say there are 21 characters in the field

then I tried this line second :
LenCount = Browser("A").Page("A").WebEdit("Bar Number Input").GetROProperty("value")

and I recieved a null value when I did message box
msgbox LenCount
Count = (Len(LenCount))

If CLng(LenCount) > 20 Then
    Reporter.ReportEvent micPass, " field actual length = "&LenCount& ",Verified the field Exceeds 20 Characters""Passed"
    Else
    Reporter.ReportEvent micFail, "  Number field"" Bar Number field Does Not Exceed 20 Characters error message is NOT visible."
    End If
    

0 Likes
3 Replies
Highlighted
Knowledge Partner
Knowledge Partner

Re: Get character Value of field

Hi Jay, have you tried to get the value of the text field and then tried to use the VBscript Len method on the field?

Mark Smith.

0 Likes
Highlighted
Valued Contributor.. Valued Contributor..
Valued Contributor..

Re: Get character Value of field

Sperk - Thanks for responding , I thought that the code was getting value? 

Highlighted
Knowledge Partner
Knowledge Partner

Re: Get character Value of field

You need to spy on the populated edit box and use whichever field contains the string in your Len method.

Mark Smith.

 

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.