The element is there, and the click does nothing
The selector matches the button, the click reports success, and nothing moves. Three levels, in the order to try them.
The symptom. The selector matches a real, visible element. You click it,
you get succes: true, and the page does not move. Or you get a timeout on
an element that --a11y shows is there.
Why a real element can be refused
Playwright refuses to click what a person could not click. Before acting, it checks that the element is visible, stable, and not covered by something else. That check stops you from clicking a loading overlay and believing you hit the button behind it.
It also refuses things a person can click: a toggle drawn with custom CSS, a
button inside a <dialog> opened by showModal(), an element under a
decorative layer. All real, all usable, all refused.
Three levels, in this order
1. Plain click. Always start here. If it works, nothing else matters.
{"type": "cliquer", "selecteur": "#confirm"}
2. force: true. Skips Playwright’s checks and clicks anyway: the right
answer for an element that is really there but fails the checks.
{"type": "cliquer", "selecteur": "#confirm", "force": true}
3. repli_js: true. Dinoer first makes the native click (with force
if set); only if Playwright raises an error does it click the element with
JavaScript (el.click()), as you would by hand in an evaluer action.
{"type": "cliquer", "selecteur": "#dialog-confirm button[type=submit]",
"force": true, "repli_js": true}
Setting the flag does not make every click a JavaScript click: the fallback runs only after a real failure.
How to know which level did the work
The answer says so, only when the fallback actually ran:
"boussole": {"repli_js_utilise": true}
So you learn whether your target really needs level 3 before copying the flag onto every action of the scenario.
One incompatibility, reported at once
repli_js runs JavaScript, which –no-evaluer
forbids for the whole run. A call that combines them is refused with
arguments_incompatibles (exit code 2) before the browser starts.
The case that looks the same and is not
If the click fails on an element inside a dialog you opened in a previous
call, no level helps. The dialog is gone: resuming a session reloads the
page, and a dialog opened with showModal() does not survive a reload.
That is another problem, with another fix. The session does not survive between two calls →
In short
- Try the plain click, then
force: true, thenrepli_js: true, in that order. repli_jsneeds a real failure to run; it is not a JavaScript click on demand.- Read
repli_js_utiliseto learn what your target actually needs. - A click that fails on an element from a previous call is a session problem, not a click problem.