public static Create ( By locatorKind, string locatorValue ) : IElementLocator | ||
locatorKind | By | |
locatorValue | string | |
Результат | IElementLocator |
private static object?InstantiateMember <T>(FindAttribute findAttribute, IElement container, Type memberType) where T : IElement { object?element = null; if (memberType == typeof(IElement)) { element = WebElement.Create(findAttribute.Nested ? container : default(T), ElementLocator.Create(findAttribute.SelectorType, findAttribute.SelectorValue)); } else if (memberType == typeof(ISelectElement)) { element = WebElement.CreateSelect(findAttribute.Nested ? container : default(T), ElementLocator.Create(findAttribute.SelectorType, findAttribute.SelectorValue)); } else if (typeof(INavigationElement <IPage>).IsAssignableFrom(memberType)) { element = InvokeFactoryMethod("CreateNavigation", memberType.GenericTypeArguments, container, findAttribute); } else if (typeof(IFrameElement <IPage>).IsAssignableFrom(memberType)) { element = InvokeFactoryMethod("CreateFrame", memberType.GenericTypeArguments, container, findAttribute); } else if (typeof(IWindowElement <IPage>).IsAssignableFrom(memberType)) { element = InvokeFactoryMethod("CreateWindow", memberType.GenericTypeArguments, container, findAttribute); } else if (typeof(WebControl).IsAssignableFrom(memberType)) { if (memberType.GetInterfaces().Any(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(IListElement <>))) { element = InvokeFactoryMethod("CreateList", memberType.GenericTypeArguments, container, findAttribute); } else { element = InvokeFactoryMethod("CreateControl", new Type[] { memberType }, container, findAttribute); } } return(element); }
public WebPage(Browser browser, string titlePattern) : base(browser, null, ElementLocator.Create(By.TagName, "html")) { this.titlePattern = titlePattern; }