I'm trying to convert the following code snippet: self.client = self.page.context.new_cdp_session(self.page) self.client.send( "DOMSnapshot.captureSnapshot", {"computedStyles": [], "includeDOMRects": True, "includePaintOrder": True}, ) Into native javascript that I could run within a chrome extension. How would I do that? For added context, I will need to be able to index into the results like so: strings = tree["strings"] document = tree["documents"][0] nodes = document["nodes"] backend_node_id = nodes["backendNodeId"] attributes = nodes["attributes"] node_value = nodes["nodeValue"] parent = nodes["parentIndex"] node_types = nodes["nodeType"] node_names = nodes["nodeName"] is_clickable = set(nodes["isClickable"]["index"]) text_value = ...
A site where you can share knowledge