public static By XPath(string xpathToFind)
{
if (xpathToFind == null)
{
throw new ArgumentNullException("xpathToFind", "Cannot find elements when the XPath expression is null.");
}
By by = new By();
by.findElementMethod = (ISearchContext context) => ((IFindsByXPath)context).FindElementByXPath(xpathToFind);
by.findElementsMethod =
(ISearchContext context) => ((IFindsByXPath)context).FindElementsByXPath(xpathToFind);
by.description = "By.XPath: " + xpathToFind;
return by;
}