AngleSharp by AngleSharp

<PackageReference Include="AngleSharp" Version="1.3.0" />

 BrowsingContextExtensions

public static class BrowsingContextExtensions
A set of extensions for the browsing context.
public static IBrowsingContext CreateChildFor(this IBrowsingContext context, string target)

Creates the specified target browsing context.

public static IBrowsingContext FindChildFor(this IBrowsingContext context, string target)

Gets the specified target browsing context.

public static ICommand GetCommand(this IBrowsingContext context, string commandId)

Tries to get the command with the given name.

public static string GetCookie(this IBrowsingContext context, Url url)

Gets the cookie for the given URL, if any.

public static IStylingService GetCssStyling(this IBrowsingContext context)

Tries to get the CSS styling service, if available.

public static CultureInfo GetCulture(this IBrowsingContext context)

Gets the culture info associated with the current context.

public static CultureInfo GetCultureFrom(this IBrowsingContext context, string language)

Gets the culture from the language string (or the current culture).

public static Encoding GetDefaultEncoding(this IBrowsingContext context)

Gets the default encoding to use as initial guess.

public static IEnumerable<Task> GetDownloads<T>(this IBrowsingContext context) where T : INode

Checks if the context is waiting for tasks from originator of type T to finish downloading.

public static TFactory GetFactory<TFactory>(this IBrowsingContext context)

Gets a factory service instance. Exactly one has to be available.

Tries to get the JavaScript service, if available.

public static string GetLanguage(this IBrowsingContext context)

Gets the language of the current context.

Gets the navigation handler that supports the provided protocol.

public static TProvider GetProvider<TProvider>(this IBrowsingContext context)

Gets a provider service instance. At most one has to be available.

public static IResourceService<TResource> GetResourceService<TResource>(this IBrowsingContext context, string type) where TResource : IResourceInfo

Gets a resource service. Multiple resource services may be registered, so the one that matches the given mime-type will be returned, if any.

public static IScriptingService GetScripting(this IBrowsingContext context, string type)

Tries to get the scripting service for the given mime-type.

public static ISpellCheckService GetSpellCheck(this IBrowsingContext context, string language)

Gets the spell check service for the given language, if any.

public static IStylingService GetStyling(this IBrowsingContext context, string type)

Tries to get the styling service for the given mime-type.

public static Task InteractAsync<T>(this IBrowsingContext context, string eventName, T data)

Fires an interactive event at the given context.

public static bool IsScripting(this IBrowsingContext context)

Gets if the context allows scripting or not.

public static void NavigateTo(this IBrowsingContext context, IDocument document)

Navigates to the given document. Includes the document in the session history and sets it as the active document.

public static Task<IDocument> OpenAsync(this IBrowsingContext context, IResponse response, CancellationToken cancel = default)

Opens a new document created from the response asynchronously in the given context.

public static Task<IDocument> OpenAsync(this IBrowsingContext context, DocumentRequest request, CancellationToken cancel = default)

Opens a new document loaded from the specified request asynchronously in the given context.

public static Task<IDocument> OpenAsync(this IBrowsingContext context, Url url, CancellationToken cancel = default)

Opens a new document loaded from the provided url asynchronously in the given context.

public static Task<IDocument> OpenAsync(this IBrowsingContext context, Action<VirtualResponse> request, CancellationToken cancel = default)

Opens a new document loaded from a virtual response that can be filled via the provided callback.

public static Task<IDocument> OpenAsync(this IBrowsingContext context, string address, CancellationToken cancellation = default)

Opens a new document loaded from the provided address asynchronously in the given context.

public static Task<IDocument> OpenNewAsync(this IBrowsingContext context, string url = null, CancellationToken cancellation = default)

Opens a new document without any content in the given context.

public static IBrowsingContext ResolveTargetContext(this IBrowsingContext context, string target)

Resolves the given target context.

public static void SetCookie(this IBrowsingContext context, Url url, string value)

Sets the cookie for the given URL.

public static void TrackError(this IBrowsingContext context, Exception ex)

Notifies the context of an exception that was handled internally.