chrome-devtools-kotlin / org.hildan.chrome.devtools.domains.dom / findNodeBySelector

findNodeBySelector

suspend fun DOMDomain.findNodeBySelector(selector: String): NodeId?

Retrieves the ID of the node corresponding to the given selector, or null if not found.

Note that the returned NodeId cannot really be used to retrieve actual node information, and this is apparently by design of the DOM domain. It can be used to perform other CDP commands that require a NodeId, though.