Dinoer

The form reports success and never submits

The click succeeds, the scenario ends without error, and the server received nothing. Two different causes give this same result, and the fix for one does not fix the other.

The symptom. You fill a form, click submit, get succes: true, and the target is unchanged. Reading the page afterwards shows the same page, never the result you expected.

Two unrelated causes give this same result. Tell them apart before choosing a fix.

Cause 1: the browser blocked the submission

HTML5 validation. A field marked required is empty, or a type="email" field holds something that is not an address. The browser refuses to send the form and shows a small message next to the field.

Dinoer reports the click as successful, because it was: the click happened. The browser declined to act on it.

How to recognise it. Nothing was sent, so nothing loads: in latences_actions, an attendre_navigation placed right after the click returns at once. To see which fields block, ask the page:

{"type": "evaluer",
 "script": "Array.from(document.querySelectorAll(':invalid')).map(e => e.name || e.id)"}

The fix. Fill the missing field. If it must stay empty on purpose, submit the form directly, which skips native validation:

{"type": "evaluer",
 "script": "document.querySelector('#my-form').submit()"}

Cause 2: a click from JavaScript is not a user’s click

Calling .click() on a submit button from JavaScript produces an event marked isTrusted: false. Scripts on the page can ignore or cancel such an event, and some do: the scenario ends succes: true and the form was never sent.

{"type": "evaluer",
 "script": "document.querySelector('input[name=upgrade]').click()"}

The fix. Prefer a real cliquer on the button: Playwright’s click is treated like a user’s. From evaluer, submit the form itself:

{"type": "evaluer",
 "script": "document.querySelector('input[value=\"theme-slug\"]').closest('form').requestSubmit()"}

requestSubmit() runs validation and the form’s own submit handlers, as a user’s submission does. submit() skips both: use it only when you know the form posts directly to the server.

The rule worth keeping

To submit a form, prefer cliquer on the button. From evaluer, call requestSubmit() on the form, never .click() on the button.

Before you conclude

A submission that seems to have failed may have succeeded. A slow request (an import, a copy, anything that takes tens of seconds) can exceed the timeout while the server carries on and finishes the work. A TimeoutError on a click means that Playwright stopped waiting, not that nothing happened.

Check the target before retrying, or you will run the operation twice. The operation that takes a while →

In short

  • Two causes, one symptom: native validation blocked the form, or a JavaScript .click() was ignored.
  • evaluer with :invalid lists the fields that block.
  • Prefer cliquer; from evaluer, requestSubmit() on the form.
  • A timeout is not a failure: check before you retry.