I am automating a form, the scenario is, when an invalid entry is given, the message 'Success' shouldn't appear
I tried to check this using
s_assert.assertEquals(driver.findElement(By.xpath("//div[contains(.,'Succes')]")).isDisplayed(), false);
But, while running, it shows 'Unable to locate element:'
The message appears only if my test fails. So expected behavior is that, the element won't be present.
How to tell webdriver
to just check if it is present and to not to throw an error! Thanks in advance...