Laravel Dusk NoSuchElementException / Unable to locate element Laravel Dusk NoSuchElementException / Unable to locate element google-chrome google-chrome

Laravel Dusk NoSuchElementException / Unable to locate element


For those who still have a problem: check APP_URL variable in your Laravel's .env file. URL on which the application is running must match with the APP_URL parameter


I hope you have solved this problem by this time. According to the Laravel Dusk documentation

although the method accepts one if necessary, we are not required to pass a CSS selector into the type method. If a CSS selector is not provided, Dusk will search for an input field with the given name attribute. Finally, Dusk will attempt to find a textarea with the given name attribute.

Looking at your error, it seems like you are passing the wrong selector. Try using name of the input fields as below

$browser->type('name', $name)        ->type('email', $email)        ->type('password', $password)        ->type('password_confirmation', $passwordConfirmation)        ->press('Register');