Hi, had the same error while developing on two different systems. For me it was the $baseUrl, in the TestCase Class, which was different in both cases.
Laravel 5.1: Test unable to locate submit button
Dear Laravel Experts
I'm currently trying to do some very basic testing. More specifically, I'm using Laravel 5.1's testing facilities to test the successfull submission of a form.
Unfortunately, I receive the following error:
InvalidArgumentException: Could not find a form that has submit button [register].
The relevant portion of my form looks like this:
<form role="form" method="POST" action="/auth/register">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="text" name="name" value="{{ old('name') }}">
<input type="submit" value="register">
</form>
My test looks like this:
$this->visit('/auth/register')
->type('Test User', 'name')
->press('register');
Any idea, why this error may occur?
I actually tried to copy and paste the "Working With Forms" example from the Laravel documentation, but experience the same error: InvalidArgumentException: Could not find a form that has submit button [register].
I assume that this is related to the Symfony DomCrawler component, but cannot figure out where I'm failing.
Any help is very much appreciated! :-) Thanks.
Please or to participate in this conversation.