I am using headless mode with ChromeDriver. I find an element by calling
var name= Driver.FindElement(By.Id("TestLabelName"));
if (name== null)
{
}
The issue here is that if the element is not present it just exceptions and stops and doesnt do the null check. Is there a way to return either the element or just null ? Or return the console window data without having to wrap every FindElement around a try catch ?