How to capture field validation message with UFT?
Question ID: 107785
2
0

UFT did not recognize the validation message object displayed on the screen.

Example: A login field is left blank and a validation message is displayed stating that "This field is required".
But the message goes away as soon as clicking outside the screen. How can we capture this message object using UFT?

Message is being rendered with the HTML5 "required" tag.

Marked as spam
Posted by (Questions: 387, Answers: 66)
Asked on July 27, 2017 5:46 pm
581 views
Answers (1)
2
Private answer

Try the below steps to accomplish this. Some modification might be needed, but this should work with most HTML 5 objects with the ''required'' tag.

Troubleshooting example can be found on [http://www.w3schools.com/html/tryit.asp?filename=tryhtml5_input_required][1]

1. Open the object repository and highlight Test Objects in the left pane.
2. Click the Define New Test Object icon.
3. Set the following properties:
Environment: Web
Class: Page
Name: Whatever you want. For this example, we'll call it Validator
4. Click Add.
5. Click the Validator object in the object tree.
6. Change the Ordinal Identifier to Type:Index, Value:0
7. With the Validator page still highlighted, click the Define New Test Object icon again.
8. Set the following properties:
Environment: Web
Class: WebElement
Name: Whatever you want. For this example, we'll call it Validation
html tag: DIV
html id: contentContainer
Delete any other properties that are present
9. Click Add.
10. In your test, do whatever causes the validation message to appear.
11. Use the following code to grab the text of the validation message:

strMessage = Page(''Validator'').WebElement(''Validation'').GetROProperty(''innertext'')

Now you can validate that strMessage contains the text you expect.

[1]: http://www.w3schools.com/html/tryit.asp?filename=tryhtml5_input_required

Marked as spam
Posted by (Questions: 17, Answers: 807)
Answered on July 27, 2017 5:47 pm
0
this procedure works for us.
( at July 27, 2017 5:47 pm)
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top