Is that your question on SO? https://stackoverflow.com/questions/49762322/testing-focus-in-laravel-dusk
Did you try adding sleep(1) before you check for focus?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
We have an application that has a Vue.js front end and a Laravel API back end. We have tests in vue-test-utils, PHPUnit, and Dusk for various things.
I've started to write a Dusk test to make sure that a particular element receives focus after a form is submitted. But I can't see a clear way to do that in Dusk and now I'm wondering if Dusk is even the place to do it. Here is the exact scenario:
I have a search page with a form. Once you click "Search", a list of results displays. I have a vue.js directive to set focus on the first in that results list.
Any insights re. how to perform this check in Dusk, or elsewhere, are greatly appreciated!
Please or to participate in this conversation.