# Clearing a numeric or text field does not fire off validation message

**URL:** <https://forum.robotframework.org/t/clearing-a-numeric-or-text-field-does-not-fire-off-validation-message/3812>\
**Category:** Robot Framework\
**Created:** [17 May 2022 01:19 UTC](https://forum.robotframework.org/t/clearing-a-numeric-or-text-field-does-not-fire-off-validation-message/3812 "2022-05-17T01:19:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bweston](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/bweston/32/1298_2.png) [@bweston](https://forum.robotframework.org/u/bweston)\
**Post date:** [17 May 2022 01:19 UTC](https://forum.robotframework.org/t/clearing-a-numeric-or-text-field-does-not-fire-off-validation-message/3812/1 "2022-05-17T01:19:33Z")

</div>

I have numeric and text fields that when blank fire a message to let user know input is required. If I manually perform the test the message will appear, but when I use Selenium Library keywords to either “clear element text” or “input text” with an empty string the message will not fire.

In both of these examples, I am first tabbing to the field from a previous field and then invoking the keywords. The fields in the example have data in them. I notice the data in the fields get highlighted and then are removed. I do not know how the code removes the data (back button or delete) but I cannot replicate the issue of not having the message fired when I manually remove the data.

Examples:  
input text //_[@id=“amountInput”] \ clear=true  
press keys //_[@id=“amountInput”] TAB

OR  
clear element text //_[@id=“amountInput”]  
press keys //_[@id=“amountInput”] TAB

Message that would get fired  
 ![image](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/3/3752a68be465cf1f2bd5744f6a039f6614d6b4ac.png)

I have tested a few other options but the results were never 100%.

press keys //\*[@id=“amountInput”] CTRL+A+BACKSPACE  
page should contain Amount is required

OR

press keys //\*[@id=“amountInput”] A+BACKSPACE  
page should contain Amount is required

---

<div class="post-metadata">

**Author:** ![coopernico46](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@coopernico46](https://forum.robotframework.org/u/coopernico46)\
**Post date:** [19 June 2024 15:48 UTC](https://forum.robotframework.org/t/clearing-a-numeric-or-text-field-does-not-fire-off-validation-message/3812/2 "2024-06-19T15:48:36Z")

</div>

Same issue. Didi you find the way to make it work?

---

<div class="post-metadata">

**Author:** ![\_daryl](https://avatars.discourse-cdn.com/v4/letter/_/45deac/32.png) [@\_daryl](https://forum.robotframework.org/u/_daryl)\
**Post date:** [19 June 2024 20:18 UTC](https://forum.robotframework.org/t/clearing-a-numeric-or-text-field-does-not-fire-off-validation-message/3812/3 "2024-06-19T20:18:52Z")

</div>

Depending on the event, try making a click away from the field. So pick a random element you can click to after clearing, you may find it triggers the event.

---

<div class="post-metadata">

**Author:** ![coopernico46](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@coopernico46](https://forum.robotframework.org/u/coopernico46)\
**Post date:** [19 June 2024 22:41 UTC](https://forum.robotframework.org/t/clearing-a-numeric-or-text-field-does-not-fire-off-validation-message/3812/4 "2024-06-19T22:41:24Z")

</div>

Thanks @_daryl  
After several attemps with different keywords the only one that works in my webapp was:

press keys ${webitem} CTRL+A+BACKSPACE

---

<div class="post-metadata">

**Author:** ![rasjani](https://avatars.discourse-cdn.com/v4/letter/r/858c86/32.png) [@rasjani](https://forum.robotframework.org/u/rasjani)\
**Post date:** [20 June 2024 12:06 UTC](https://forum.robotframework.org/t/clearing-a-numeric-or-text-field-does-not-fire-off-validation-message/3812/5 "2024-06-20T12:06:09Z")

</div>

This is typical issue with application not really written for testability - input validation is hooked into key press events only. Approach works for actual human but not for automation purposes.
