INNER CODE UNIT · Python

op_evaluate

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

    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
        every single time, was caught, and answered False - so the landing
        override was never applied and EVERY click fell on the exact geometric
        centre of its element. That is the tell `_landing_override`'s own
        docstring describes: one exact number, identical in every install,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…