How To write script in QTP For Field Validation Example:
password Field is accepting A range 8-20 characters
only.How to write script?

Answers were Sorted based on User's Feedback



How To write script in QTP For Field Validation Example: password Field is accepting A range 8-20 ..

Answer / ganesh kumar

Dim strTextValue

strtextValue = Browser("Browser").Pge("Page").Frame
("Frame").webEdit("Password").GetRoProperty("value")
If strTextValue <8 Then
Reporter.ReportEvent micFail,"Check for the Feild
validation","The Feild is accepting Lesserthan
lowerBoundary value"

ElseIf strTextValue>20 Then
Reporter.ReportEvent micFail,"Check for the Feild
validation","The Feild is accepting Greater than
UpperBoundary value"

Else
Reporter.ReportEvent micFail,"Check for the Feild
validation","The Feild is not accepting lesserthan or
Greater than the Boundary value"

EndIF

Is This Answer Correct ?    14 Yes 12 No

How To write script in QTP For Field Validation Example: password Field is accepting A range 8-20 ..

Answer / max

Replace micFail with micPass in Ganesh Kumar's Answer.
(See below the last part of his answer, ... now modified)

Else
Reporter.ReportEvent micPass,"Check for the Feild
validation","The Feild is not accepting lesserthan or
Greater than the Boundary value"

Is This Answer Correct ?    6 Yes 4 No

How To write script in QTP For Field Validation Example: password Field is accepting A range 8-20 ..

Answer / uday

here the question is how to find the max and min. lengths
the webedit accepts?

To find the max length of the web edit, try with "max
length" property.
temp=browser("Browser").Page("Page").WebEdit("username").GetROProperty("max
length"). It works.

I am not sure about the min. legth.

Thanks,
Uday.

Is This Answer Correct ?    5 Yes 4 No

Post New Answer

More QTP Interview Questions

How to create an Action Template?

1 Answers  


I AM TRYING PORT CODE FROM WINRUNNER TO QTP AND DON'T KNOW TO HOW TO CHECK THE ERRORS. IN WINRUNNER FUNCTION RETURNS EIGHER 0 OR -1 AGAINST WHICH RESULT CAN BE MADE PASS OR FAIL BUT IN QTP I DON'T SEE FUNCTIONS RETURNING ANY VALUE. APPRECIATE IF ANYONE COULD HELP ME CONVERTING FOLLWOING WINRUNNER CODE TO QTP. set_window("Customer Service"); rc = web_obj_get_text("Summary","#2","#4",ssn,""," ",1); if (rc != E_OK) { report_msg("[GetSubscriberSummary] Could Not get subscriber SSN; rc = "&rc); myRC = rc; } else { ssn = StripBlank(ssn); if (DEBUG) report_msg ("[GetSubscriberSummary] SSN: "&ssn); }

0 Answers  


Hi all, I am New to QTP . I am Now in critical situtaion. I want to know How to create our own object respository for our application. please say the answer with example.

3 Answers  


is it possible to operate(on/off)the capslock using qtp

2 Answers  


What are the Features & Benefits of Quick Test Pro (QTP)..?

5 Answers  






How we will execute(run) the scripts in qtp 8.2?

1 Answers  


Can we run multiple QTP scripts one after the other without manual intervention? How?

0 Answers  


Suppose there are 100 links in a web page and the number of links will be changing dynamically from time to time. I need code such that every time i had to click on the last link of the web page.

4 Answers   Virtusa,


Have you used xml check point in your project?

0 Answers  


wt is frame work wt r d different types of frame works used in ur company

1 Answers   Infotech,


what difference between runtime object and text object and what property they have. whether they have same properties or different properties.

0 Answers   Intel, Satyam,


Which is the best testing institute for QTP training in Hyderabad.

25 Answers   Wipro,


Categories