Class LoadableComponent<T>
Represents any abstraction of something that can be loaded.
This may be an entire web page, or simply a component within that page (such as a login box or menu) or even a service.
// Example usage:
new MyComponent().Load();
public abstract class LoadableComponent<T> : ILoadableComponent where T : LoadableComponent<T>
Type Parameters
T
The type to be returned (normally the subclass' type)
- Inheritance
-
LoadableComponent<T>
- Implements
- Derived
- Inherited Members
Remarks
After the Load() method is called, the component will be loaded and ready for use.
Overload the protected Load and IsLoaded members to both load a component and determine if the component is already loaded.
Properties
IsLoaded
Gets a value indicating whether the component is fully loaded.
protected bool IsLoaded { get; }
Property Value
Remarks
When the component is loaded, this property will return true or false depending on the execution of EvaluateLoadedStatus() to indicate the not loaded state.
UnableToLoadMessage
Gets or sets the message for the exception thrown when a component cannot be loaded
public virtual string? UnableToLoadMessage { get; set; }
Property Value
Methods
EvaluateLoadedStatus()
Determine whether or not the component is loaded. Subclasses are expected to provide the details to determine if the page or component is loaded.
protected abstract bool EvaluateLoadedStatus()
Returns
- bool
A boolean value indicating if the component is loaded.
ExecuteLoad()
When this method returns, the component modeled by the subclass should be fully loaded. This subclass is expected to navigate to an appropriate page or trigger loading the correct HTML should this be necessary.
protected abstract void ExecuteLoad()
HandleLoadError(WebDriverException)
HandleLoadError gives a subclass the opportunity to handle a WebDriverException that occurred during the execution of ExecuteLoad().
protected virtual void HandleLoadError(WebDriverException ex)
Parameters
ex
WebDriverExceptionThe exception which occurs on load.
Load()
Ensure that the component is currently loaded.
public virtual T Load()
Returns
- T
The loaded component.
Remarks
This is equivalent to the Get() method in Java version.
TryLoad()
Attempts to load this component, providing an opportunity for the user to handle any errors encountered during the load process.
protected T TryLoad()
Returns
- T
A self-reference to this LoadableComponent<T>