I am trying to hover over an element in a menu bar with selenium, but having difficulty locating the element. The element is displayed below :
Better ignoring the whitespaces around the text with this:
var elm = driver.FindElement(By.XPath("//a[normalize-space() = 'TextToFind']"));
This searches text within an [a] element, you can replace it with any element you are interested in (div, span etc.).