I have a Selenium suite testing my (web) user interface and I'm trying to prove that the appropriate error messages appear when a User puts in invalid values.
<input id="inputID" type="number" min="1" step="1" />
WebElement element = webDriver.findElement(By.id("inputID"));
element.click();
element.sendKeys("-2");
element.??????
It's trivial to do by hand, but for the life of me I can't figure out how to test that the input:invalid
CSS is applied or how to read/test the tooltip value.
It would probably be sufficient to prove that the field is marked as invalid, even if we don't test the content of the tooltip, though ideally we'd test both.