Hi @bweston,
*I’ll guess you’re using SeleniumLibrary? so I’ll use those keywords, but you can change them to the library you’re using.
You generated a random string, but you didn’t enter it into your field, actually you didn’t do anything with it.
The approach I would take is to generate the random string, enter it into your description field, check the page for the error you expected, then read back the content of the description field and check the length to verify only 20 char got accepted.
click element //*[@id="descriptionInput"]
${newdesc}= generate random string 21 [NUMBERS]abcdef
Input Text //*[@id="descriptionInput"] ${newdesc}
page should contain Description can be a maximum of 20 characters
${descvalue}= Get Text //*[@id="descriptionInput"]
${length}= Get Length ${descvalue}
Should Be Equal As Integers ${length} 20
Now depending on your requirements it might be valid for the description field to have more than 20 chars as long as only 20 got saved, so your next step would probably be to submit the form, then open the record that was created, then check the length of value for description when the record is opened.
Dave.