/// <summary> /// Gets the child page objects. /// If a child page object is a generic type definition that matches with the hint type, this type is returned. /// The hint is necessary since the type parameters cannot be "guessed". /// </summary> /// <typeparam name="TPageObjectChildHint">The hint type for a generic type definition page object child.</typeparam> /// <returns>The child page objects.</returns> public IEnumerable <IPageObject> Children <TPageObjectChildHint>() { List <IPageObject> result = new List <IPageObject>(); foreach (var childPageObject in Locate.ChildTypes(this).Union(RootInternal.DynamicChildren(GetType()))) { Type toAdd; Type hintType = typeof(TPageObjectChildHint); if (!childPageObject.IsGenericTypeDefinition) { toAdd = childPageObject; } else if (hintType.IsGenericType && hintType.GetGenericTypeDefinition() == childPageObject) { // check if the type definition of the page object we are searching for, is the same as the child page object // use the type parameters passed via the type argument toAdd = hintType; } else { continue; } // create and init child page object result.Add(((IUIObjectInternal)Activator.CreateInstance(toAdd)).Init(this) as IPageObject); } return(result); }
/// <summary> /// Gets an await-object. /// </summary> /// <typeparam name="T">The underlying type.</typeparam> /// <param name="function">The function to wrap.</param> /// <param name="name">The display name used in timeout exceptions.</param> /// <returns>The wrapped object.</returns> protected IAwait <T> Await <T>(Func <T> function, string name) { return(RootInternal.Await(function, name)); }
/// <summary> /// Gets an await-object. /// </summary> /// <typeparam name="T">The underlying type.</typeparam> /// <param name="function">The function to wrap.</param> /// <param name="name">The display name used in timeout exceptions.</param> /// <returns>The wrapped object.</returns> protected IAwait <T> Await <T>(Func <T> function, string name) => RootInternal.Await(function, name);