ILifecycleHook Interface#
Hooks into the browser automation lifecycle for cross-cutting concerns (logging, performance measurement, automatic retries).
public interface ILifecycleHook
Methods#
AfterActionAsync(IPage, string, ActionResult) Method#
Called after each user action completes.
System.Threading.Tasks.Task AfterActionAsync(Motus.Abstractions.IPage page, string action, Motus.Abstractions.ActionResult result);
Parameters#
page IPage
The page containing the element.
action System.String
The action name.
result ActionResult
The outcome of the action. Error is null on success.
Returns#
AfterNavigationAsync(IPage, IResponse) Method#
Called after each navigation completes.
System.Threading.Tasks.Task AfterNavigationAsync(Motus.Abstractions.IPage page, Motus.Abstractions.IResponse? response);
Parameters#
page IPage
The page that was navigated.
response IResponse
The navigation response, or null if navigation produced no response.
Returns#
BeforeActionAsync(IPage, string) Method#
Called before each user action (click, fill, type).
System.Threading.Tasks.Task BeforeActionAsync(Motus.Abstractions.IPage page, string action);
Parameters#
page IPage
The page containing the element.
action System.String
The action name (e.g. "click", "fill").
Returns#
BeforeNavigationAsync(IPage, string) Method#
Called before each page navigation.
System.Threading.Tasks.Task BeforeNavigationAsync(Motus.Abstractions.IPage page, string url);
Parameters#
page IPage
The page being navigated.
url System.String
The target URL.
Returns#
OnConsoleMessageAsync(IPage, ConsoleMessageEventArgs) Method#
Called when a console message is emitted.
System.Threading.Tasks.Task OnConsoleMessageAsync(Motus.Abstractions.IPage page, Motus.Abstractions.ConsoleMessageEventArgs message);
Parameters#
page IPage
The page that emitted the message.
message ConsoleMessageEventArgs
The console message details.
Returns#
OnPageClosedAsync(IPage) Method#
Called when a page is closed.
System.Threading.Tasks.Task OnPageClosedAsync(Motus.Abstractions.IPage page);
Parameters#
page IPage
The page being closed.
Returns#
OnPageCreatedAsync(IPage) Method#
Called when a new page is created.
System.Threading.Tasks.Task OnPageCreatedAsync(Motus.Abstractions.IPage page);
Parameters#
page IPage
The newly created page.
Returns#
OnPageErrorAsync(IPage, PageErrorEventArgs) Method#
Called when an uncaught page error occurs.
System.Threading.Tasks.Task OnPageErrorAsync(Motus.Abstractions.IPage page, Motus.Abstractions.PageErrorEventArgs error);
Parameters#
page IPage
The page where the error occurred.
error PageErrorEventArgs
The error details including message and stack trace.