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
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