Class BrowsingContextModuleExtensions
- Namespace
- WebDriverBiDi.BrowsingContext
- Assembly
- WebDriverBiDi.Extensions.dll
Provides extension methods for the BrowsingContext module.
public static class BrowsingContextModuleExtensions
- Inheritance
-
BrowsingContextModuleExtensions
- Inherited Members
Methods
CaptureScreenshotAsync(BrowsingContextModule, string, ScreenshotOrigin, TimeSpan?, CancellationToken)
Captures a PNG screenshot of a browsing context.
public static Task<byte[]> CaptureScreenshotAsync(this BrowsingContextModule module, string browsingContextId, ScreenshotOrigin origin = ScreenshotOrigin.Viewport, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
moduleBrowsingContextModuleThe BrowsingContextModule to extend.
browsingContextIdstringThe ID of the browsing context.
originScreenshotOriginWhether to capture the viewport or the whole document.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA token that cancels waiting for the command's response.
Returns
CloseAsync(BrowsingContextModule, string, TimeSpan?, CancellationToken)
Closes a browsing context.
public static Task CloseAsync(this BrowsingContextModule module, string browsingContextId, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
moduleBrowsingContextModuleThe BrowsingContextModule to extend.
browsingContextIdstringThe ID of the browsing context.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA token that cancels waiting for the command's response.
Returns
- Task
A task representing the asynchronous operation.
GetTopLevelBrowsingContextsAsync(BrowsingContextModule, TimeSpan?, CancellationToken)
Gets the top-level browsing contexts (tabs and windows), without their child frames.
public static Task<IReadOnlyList<BrowsingContextInfo>> GetTopLevelBrowsingContextsAsync(this BrowsingContextModule module, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
moduleBrowsingContextModuleThe BrowsingContextModule to extend.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA token that cancels waiting for the command's response.
Returns
- Task<IReadOnlyList<BrowsingContextInfo>>
The top-level browsing contexts.
LocateNodesByAccessibleRoleAsync(BrowsingContextModule, string, string, string?, IEnumerable<SharedReference>?, TimeSpan?, CancellationToken)
Finds the nodes with an accessible role and, optionally, an accessible name.
public static Task<IReadOnlyList<SharedReference>> LocateNodesByAccessibleRoleAsync(this BrowsingContextModule module, string browsingContextId, string accessibleRole, string? accessibleName = null, IEnumerable<SharedReference>? parentNodes = null, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
moduleBrowsingContextModuleThe BrowsingContextModule to extend.
browsingContextIdstringThe ID of the browsing context.
accessibleRolestringThe accessible role, such as "button".
accessibleNamestringThe accessible name, or null to match any.
parentNodesIEnumerable<SharedReference>The nodes within which to search, or null for the whole document.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA token that cancels waiting for the command's response.
Returns
- Task<IReadOnlyList<SharedReference>>
References to the matching nodes.
LocateNodesByCssSelectorAsync(BrowsingContextModule, string, string, IEnumerable<SharedReference>?, TimeSpan?, CancellationToken)
Finds the nodes matching a CSS selector.
public static Task<IReadOnlyList<SharedReference>> LocateNodesByCssSelectorAsync(this BrowsingContextModule module, string browsingContextId, string cssSelector, IEnumerable<SharedReference>? parentNodes = null, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
moduleBrowsingContextModuleThe BrowsingContextModule to extend.
browsingContextIdstringThe ID of the browsing context.
cssSelectorstringThe CSS selector.
parentNodesIEnumerable<SharedReference>The nodes within which to search, or null for the whole document.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA token that cancels waiting for the command's response.
Returns
- Task<IReadOnlyList<SharedReference>>
References to the matching nodes.
LocateNodesByVisibleTextAsync(BrowsingContextModule, string, string, bool, bool, IEnumerable<SharedReference>?, TimeSpan?, CancellationToken)
Finds the nodes whose rendered text matches.
public static Task<IReadOnlyList<SharedReference>> LocateNodesByVisibleTextAsync(this BrowsingContextModule module, string browsingContextId, string text, bool isPartialMatch = true, bool matchCase = false, IEnumerable<SharedReference>? parentNodes = null, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
moduleBrowsingContextModuleThe BrowsingContextModule to extend.
browsingContextIdstringThe ID of the browsing context.
textstringThe text.
isPartialMatchbooltrue to match nodes whose text contains
text; false to match only nodes whose text is exactly it.matchCasebooltrue to match case.
parentNodesIEnumerable<SharedReference>The nodes within which to search, or null for the whole document.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA token that cancels waiting for the command's response.
Returns
- Task<IReadOnlyList<SharedReference>>
References to the matching nodes.
LocateNodesByXPathAsync(BrowsingContextModule, string, string, IEnumerable<SharedReference>?, TimeSpan?, CancellationToken)
Finds the nodes matching an XPath expression.
public static Task<IReadOnlyList<SharedReference>> LocateNodesByXPathAsync(this BrowsingContextModule module, string browsingContextId, string xpath, IEnumerable<SharedReference>? parentNodes = null, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
moduleBrowsingContextModuleThe BrowsingContextModule to extend.
browsingContextIdstringThe ID of the browsing context.
xpathstringThe XPath expression.
parentNodesIEnumerable<SharedReference>The nodes within which to search, or null for the whole document.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA token that cancels waiting for the command's response.
Returns
- Task<IReadOnlyList<SharedReference>>
References to the matching nodes.
NavigateAsync(BrowsingContextModule, string, string, ReadinessState?, TimeSpan?, CancellationToken)
Navigates a browsing context to a URL.
public static Task<string> NavigateAsync(this BrowsingContextModule module, string browsingContextId, string url, ReadinessState? wait = null, TimeSpan? timeoutOverride = null, CancellationToken cancellationToken = default)
Parameters
moduleBrowsingContextModuleThe BrowsingContextModule to extend.
browsingContextIdstringThe ID of the browsing context.
urlstringThe URL.
waitReadinessState?How far the new document must have loaded before the command completes, or null for the remote end's default.
timeoutOverrideTimeSpan?The timeout override to use for the command. If omitted, the value of DefaultCommandTimeout is used.
cancellationTokenCancellationTokenA token that cancels waiting for the command's response.