Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Checking that a field cannot go above a certain number of characters
#1
Hi All,

I am testing a web page which has fields on it that have restricted character lengths that are set by javascript.

For example, if a user tries to type more than 10 characters in a field once they get to character 10 they will not be able to type any more characters - no error message appears.

I am stuck on how I would test this using QTP. I need to ensure that it is not possible to type more than 11 characters, how would I go about this?

The code I have written so far is as follows:

Code:
For i = 9 to 10 Browser("Reg").Page("Reg").WebEdit("in_post").Set "XXXX XXXX"&i sPost(i) = Browser("Reg").Page("Reg").WebEdit("in_post").GetROProperty("value") msgbox("Post is now "&sPost(i)) Next If sPost(10) = "XXXX XXXX10" Then Reporter.ReportEvent micFail Else Reporter.ReportEvent micPass End If

The problem I have with this code is that for the 2nd iteration QTP reports the error 'The parameter is incorrect. Line(82): "Browser("Reg").Page("Reg").WebEdit("in_post").Set "XXXX XXXX"&i"

if anyone can help and suggest some other code that would work then i would be very grateful. Thanks.
for some reason I can't edit my post above??

I want to change one line to say:
'I am stuck on how I would test this using QTP. I need to ensure that it is not possible to type more than 10 characters, how would I go about this?'
Reply
#2
try getROProperty("max length")

ex:
Code:
retLen=browser("xx").page("xx").webedit("xx").getROProperty("max length")
Reply
#3
I didn't think of that, thanks for your help.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  getting the value from the field learning 0 1,417 03-19-2019, 09:13 AM
Last Post: learning
  Scrambled characters in uft Solution Explorer Dwarak Calayampundi 0 1,862 05-25-2016, 05:02 AM
Last Post: Dwarak Calayampundi
  spell checking of web objects kriday 3 4,549 07-05-2013, 01:37 PM
Last Post: Staff
  css sprited image checking gerfred 0 1,885 01-29-2013, 03:46 PM
Last Post: gerfred
  Password field kumar19041980 0 3,120 09-05-2012, 03:33 PM
Last Post: kumar19041980

Forum Jump:


Users browsing this thread: 1 Guest(s)