Playwright click() Not Triggering Mendix Microflow – Works with dispatchEvent(click)

0
Hi everyone, I’m running into a strange issue while automating tests for a Mendix application using Playwright. When I click a button manually in the UI, it triggers a microflow and opens a modal as expected. However, in my automated test: await page.getByRole('button', { name: 'Add Review' }).click() I am not getting any errors, but the microflow is not triggering, and that confuses me since there are no errors being raised. Using the following function did activate the microflow for me: await page.getByRole('button', { name: 'Add Review' }).dispatchEvent('click'); I’m happy that this works, but it bothers me that I don’t understand why .click()  did not work. I have used .click() for similar buttons that trigger microflows, and that worked fine. Questions: Why would .click() not trigger Mendix’s microflow, but dispatchEvent('click') does? Is this something Mendix-specific I need to take into account? Are there other ways to make this work in a more reliable way? Thanks in advance!
asked
1 answers
-1

Hi Sebastiaan Cales

.click() may not fire if Playwright thinks the button isn’t fully clickable yet. dispatchEvent('click') bypasses those checks, so it will trigger the microflow.

Even though the button looks clickable to you, Playwright may detect it as still blocked (overlay, animation, transition). So .click() doesn’t fire the event, but dispatchEvent('click') forces it and triggers the microflow.

 

If you are looking for automation testing , you can try selenium that works perfectly with mendix and I have shared in LinkedIn.[Post Link]

answered