I'm using Firefox Selenium webdrivers and Visual studio with C#.
I need to check if exists element that should not be there.
For example, in the pop-up menu are 3 elements:
In addition to checking the presence of your elements 01 through 03, also check the number of elements in the pop up menu (as mentioned by @Grasshopper's comment) :
var driver = new FirefoxDriver(); var elements = driver.FindElements(By.Id("yourPopUpMenuId")); Assert.AreEqual(3, elements.Count);
Checking the number of elements present assures you that there are no more than expected and you probably don't know what name the additional erroneous elements will have.