How can I capture Django Site Validations using Katalon Studio?

Am trying to verify that a particular error message is displayed when the user enters a figure less than the accepted minimum amount into an input field, but from the look of things, the error message am trying to capture doesn’t have web element locators:

In my opinion, this error message is just displayed courtesy of the Django page validation messages that are automatically provided by the Django framework. This is what the input field properties look like when I check the DOM:

Even when I use the WebUI.verifyTextPresent('Value must be greater than or equal to 50000.', false) built-in Keyword, Katalon doesn’t recognize the message as well, it fails the test and says the text is not present, yet I can actually see it:
image

Any ideas on how to go about this guys?

2 Likes

I have a not very good idea. As there is “something”, an image, in front of the text, perhaps you should have your verifyTextPresent take in the possibility that the error message is not exactly what we see. So, how about trying multiple statements to see if one of them is possibly correct? If one of them is okay, then you can comment the others out later.

WebUI.verifyTextPresent(".*Value must be greater than or equal to 50000..*", true)
WebUI.verifyTextPresent(".*Value must be greater than or equal to 50000.*", true)
WebUI.verifyTextPresent(".*Value must be greater than or equal to 50000.", true)
WebUI.verifyTextPresent(".*must be greater than or equal to 50000.*", true)
WebUI.verifyTextPresent(".*must be greater than or equal to 50000.", true)
1 Like

Many thanks for this suggestion, mate! So, I’ve tried out each of the lines you’ve shared above, one by one, but from the look of things, Katalon seems to perceive them as if everything inside the double quotation marks is part of the text we’re looking for. Here’s an example response for this line WebUI.verifyTextPresent(".*Value must be greater than or equal to 50000.", true):
image
I could be wrong :grimacing:

1 Like

If the error message stays on the screen for a period of time, then perhaps you can delay the timing of the “test message” until we can be sure the message is on screen.

WebUI.delay(0.5)
WebUI.verifyTextPresent(".* must be greater than or equal to .*", true)

If the above doesn’t work, then I would go with your thought that the error message is “displayed courtesy of the Django page”.

Edit: the true indicates to use “RegEx” (Regular Expression) and as you can see in your image above, the test is “using regular expression”. So that part is working. As to the “period asterisk”, that is RegEx to be a wild card indicating everything else (doesn’t matter). You can try it out on another expression that you already know you can find. Note in True RegEx, the wild card is just an asterisk, but in KS, you have to use the “period asterisk” combo.

1 Like

If the error message stays on the screen for a period of time, then perhaps you can delay the timing of the “test message” until we can be sure the message is on screen.

3 Likes

Oh, sure @grylion54, lemme try these options out and see how it goes. And thanks for the highlight about Regular Expressions, I never really knew what that meant actually, many thanks indeed :sunglasses: !