Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to validate blank field using QTP 11.00?
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi,

I am testing a web based application using QTP 11.00.
The application has a login page.
The login page has a text box with a "submit" button.
The name of the textbox is "username".

Question:

How to validate a blank field in QTP for the scenario below?

Scenario:
1. In Login page, do not enter any value for "username", click submit button.

Expected output in application:
Validation error is displayed "Please enter a username".
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi,

To check if txtBox is blank or not try the below code
Code:
valTXT=Browser(xx).Page(yy).webedit("userName").GetRoProperty("value")
if valTXT="" Then
'do something
else
Browser(xx).Page(yy).webedit("userName").Set ""
'to make field balnk
EndIF

Regards,
Sankalp
Reply
#3
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi,

I implemented the solution you suggested and it worked.

Thanks for your help.
newtester01
Reply
#4
Solved: 11 Years, 3 Months, 3 Weeks ago
Glad to hear it worked 4 u. Wink

Regards,
Sankalp
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  getting the value from the field learning 0 1,037 03-19-2019, 09:13 AM
Last Post: learning
  How to validate mandatory filed (*) in web application using balak89 1 4,109 09-13-2015, 12:54 AM
Last Post: ADITI1992
  Need to Validate Text filed is blank after clicking on the Text box balak89 3 4,893 09-13-2015, 12:06 AM
Last Post: ADITI1992
Smile Need to validate a .txt file and .jpeg image. aman8604 0 2,331 04-09-2015, 11:33 AM
Last Post: aman8604
Sad Validate New Employee Creation hello_sanjay 0 1,896 04-07-2015, 06:16 PM
Last Post: hello_sanjay

Forum Jump:


Users browsing this thread: 1 Guest(s)