I am trying to validate the character count of a text field using TestNG, & I am not getting how to do so.
Here's my code what I have done, where upper limit is 50:-
I know I am doing something wrong but unable to understand what.
Logic is right and it should be working. You are not doing anything wrong.
In what way is it not working as expected?
If you're a slave to your free associations, does it automatically become something else?
Is this code failing for your specific page, or for other pages as well?
Generally I don't like to use Selenium to test input boundries or UI interactions. This is better done on a unit level and code testing UI tends to be fragile.
SDET / Consultant