INNER CODE UNIT · Python

op_bounding_box

feder-cr/invisible_playwright · src/invisible_playwright/_juggler/server.py:247

    def op_bounding_box(self, params: Dict) -> Any:
        return {"value": self.injected.bounding_box(
            self.frame.frame_id, self.object_id)}

    def op_evaluate(self, params: Dict) -> Any:
        """`handle.evaluate(fn, arg)` - and the SECOND argument is the point.

        ⛔ IT USED TO CALL `r(el)` AND DROP `arg` ON THE FLOOR, and that was
        not a corner: Playwright's contract is `fn(element, arg)`, so every
        caller passing data got `undefined` where their value should be. The
        expression then threw inside the page, the client turned it into an
        evaluation error, and callers that treat a failed probe as "no" - which
        is the sane way to write a probe - simply took the wrong branch in
        silence.

        ⛔ THE COST, MEASURED. The humanised cursor asks the element whether an
        off-centre point actually lands on it (`_cursor._hits`, which passes
        `{x, y}` as exactly this argument). With `arg` dropped the check threw

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…