AngleSharp by Florian Rappl

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

 ApiExtensions

public static class ApiExtensions
A set of useful extension methods when dealing with the DOM.
public static T AddClass<T>(this T elements, string className) where T : IEnumerable<IElement>

Adds the specified class name(s) for all elements in the given collection.

public static T After<T>(this T elements, string html) where T : IEnumerable<IElement>

Inserts the nodes generated from the given HTML code after each element of the provided elements.

public static IEnumerable<TNode> Ancestors<TNode>(this INode child)

Gets the ancestor nodes of the given child.

public static IEnumerable<INode> Ancestors(this INode child)

Gets the ancestor nodes of the given child.

public static T Append<T>(this T elements, string html) where T : IEnumerable<IElement>

Appends the nodes generated from the given HTML code to each element of the provided elements.

public static TElement AppendElement<TElement>(this INode parent, TElement element) where TElement : IElement

Inserts a node as the last child node of this element.

public static T Attr<T>(this T elements, string attributeName, string attributeValue) where T : IEnumerable<IElement>

Sets the specified attribute name to the specified value for all elements in the given collection.

public static T Attr<T>(this T elements, IEnumerable<KeyValuePair<string, string>> attributes) where T : IEnumerable<IElement>

Sets the specified attribute name to the specified value for all elements in the given collection.

public static T Attr<T>(this T elements, object attributes) where T : IEnumerable<IElement>

Sets the specified attribute name to the specified value for all elements in the given collection.

public static Task<Event> AwaitEvent<TEventTarget>(this TEventTarget node, string eventName) where TEventTarget : IEventTarget

Returns a task that is completed once the event is fired.

public static T Before<T>(this T elements, string html) where T : IEnumerable<IElement>

Inserts the nodes generated from the given HTML code before each element of the provided elements.

public static TElement CreateElement<TElement>(this IDocument document) where TElement : IElement

Creates an element of the given type or throws an exception, if there is no such type.

public static T Css<T>(this T elements, string propertyName, string propertyValue) where T : IEnumerable<IElement>

Extends the CSS of the given elements with the specified declarations.

public static T Css<T>(this T elements, IEnumerable<KeyValuePair<string, string>> properties) where T : IEnumerable<IElement>

Extends the CSS of the given elements with the specified declarations.

public static T Css<T>(this T elements, object properties) where T : IEnumerable<IElement>

Extends the CSS of the given elements with the specified declarations.

public static IEnumerable<TNode> Descendents<TNode>(this INode parent)

Gets the descendent nodes of the given parent.

public static IEnumerable<INode> Descendents(this INode parent)

Gets the descendent nodes of the given parent.

public static T Empty<T>(this T elements) where T : IEnumerable<IElement>

Empties all provided elements.

public static bool HasClass<T>(this T elements, string className) where T : IEnumerable<IElement>

Checks if any element in the given collection has the given class(es).

public static string Html<T>(this T element) where T : IElement

Gets the inner HTML of the given element.

public static T Html<T>(this T elements, string html) where T : IEnumerable<IElement>

Sets the inner HTML of the given elements.

public static int Index<T>(this IEnumerable<T> elements, T item) where T : INode

Gets the index of the given item in the list of elements.

public static TElement InsertElement<TElement>(this INode parent, TElement newElement, INode referenceElement) where TElement : IElement

Inserts the newElement immediately before the referenceElement.

public static Task<IDocument> Navigate<TElement>(this TElement element) where TElement : IUrlUtilities, IElement

Navigates to the hyper reference given by the provided element without any possibility for cancellation.

public static Task<IDocument> Navigate<TElement>(this TElement element, CancellationToken cancel) where TElement : IUrlUtilities, IElement

Navigates to the hyper reference given by the provided element.

public static T Prepend<T>(this T elements, string html) where T : IEnumerable<IElement>

Prepends the nodes generated from the given HTML code to each element of the provided elements.

public static TElement QuerySelector<TElement>(this IParentNode parent, string selectors) where TElement : IElement

Returns the first element matching the selectors with the provided type, or null.

public static IEnumerable<TElement> QuerySelectorAll<TElement>(this IParentNode parent, string selectors) where TElement : IElement

Returns a list of elements matching the selectors with the provided type.

public static T RemoveClass<T>(this T elements, string className) where T : IEnumerable<IElement>

Removes the specified class name(s) for all elements in the given collection.

public static TElement RemoveElement<TElement>(this INode parent, TElement element) where TElement : IElement

Removes a child node from the current element, which must be a child of the current node.

public static Task<IDocument> Submit(this IHtmlFormElement form, object fields)

Submits the given form by decomposing the object into a dictionary that contains its properties as name value pairs.

public static Task<IDocument> Submit(this IHtmlFormElement form, IDictionary<string, string> fields)

Submits the given form by using the dictionary which contains name value pairs of input fields to submit.

public static string Text<T>(this T element) where T : INode

Gets the content text of the given DOM element.

public static T Text<T>(this T elements, string text) where T : IEnumerable<INode>

Sets the text content of the given elements.

public static T ToggleClass<T>(this T elements, string className) where T : IEnumerable<IElement>

Toggles the specified class name(s) for all elements in the given collection.

public static Task WhenLoadFired<TElement>(this IDocument document) where TElement : IElement

Returns a task that is completed once every element of the given type fire the the load event.

public static T Wrap<T>(this T elements, string html) where T : IEnumerable<IElement>

Wraps the given elements in the inner most element of the tree generated form the provided HTML code.

public static T WrapAll<T>(this T elements, string html) where T : IEnumerable<IElement>

Wraps all elements in the inner most element of the tree generated form the provided HTML code. The tree is appended before the first element of the given list.

public static T WrapInner<T>(this T elements, string html) where T : IEnumerable<IElement>

Wraps the content of the given elements in the inner most element of the tree generated form the provided HTML code.