Gripper

A web-scraping toolbox for .NET.

View on GitHub

Gripper.WebClient

Gripper.WebClient.IContext

IContext.FindElementByCssSelectorAsync(string) Method

Finds an element by a CSS selector on the document node of the Frame.

System.Threading.Tasks.Task<Gripper.WebClient.IElement?> FindElementByCssSelectorAsync(string cssSelector);

Parameters

cssSelector System.String
The CSS selector of the targeted element.

Returns

System.Threading.Tasks.Task<IElement>
The resulting IElement, or null if no element was matched within the document of the iFrame.

Remarks

This should not be implemented as a mapping of the DOM.querySelector call:
https://chromedevtools.github.io/devtools-protocol/tot/DOM/#method-querySelector
which is unreliable as it only takes the NodeId (as opposed to the BackendNodeId) as a parameter.
https://github.com/ChromeDevTools/devtools-protocol/issues/72