public GeckoHtmlElement LocateElement(GeckoWebBrowser browser)
{
switch (_method)
{
case LocatorMethod.ID:
return browser.Document.GetHtmlElementById(Locator);
case LocatorMethod.Name:
return browser.Document.GetElementsByName(Locator).FirstOrDefault();
case LocatorMethod.XPath:
return browser.Document.SelectSingle(Locator) as GeckoHtmlElement;
default:
throw new NotSupportedException("目前DomElementLocator只支持ID, Name, XPath三种定位方式");
}
}
}