You can use FindElements
. FindElement
would throw a NoSuchElementException
. FindElements
on the other hand returns a empty List. You can check if the list is empty and return null if true.
IList<IWebElements> elements = driver.FindElements(By.Id("abcd"));
Assert.True(elements.Count==0, "Field is editable");