INNER CODE UNIT · Python
op_content_frame
feder-cr/invisible_playwright · src/invisible_playwright/_juggler/server.py:361
def op_content_frame(self, params: Dict) -> Any:
"""The frame this element CONTAINS, for an iframe.
⛔ Answers null rather than raising when the element is not a frame
owner: that is what the client expects, and raising would turn an
ordinary "this div is not an iframe" into a failed script.
"""
result = self.page.send("Page.describeNode",
{"frameId": self.frame.frame_id,
"objectId": self.object_id}) or {}
content_frame_id = result.get("contentFrameId")
if not content_frame_id:
return {"frame": None}
frame = self.page.frame_for(content_frame_id)
return {"frame": frame.channel}