Skip to content

submitForm throws TypeError for input fields without name attribute #83

Closed
@dahaupt

Description

@dahaupt

Example form:

<form>
    <input type="text" name="username" />
    <input type="submit" value="Submit" />
</form>

When running this in an acceptance test:

$I->submitForm('form',['username' => 'Test']);

This error occurs:

[TypeError] Argument 1 passed to Codeception\Module\WebDriver::getSubmissionFormFieldName() must be of the type string, 
null given, 
called in /var/www/html/vendor/codeception/module-webdriver/src/Codeception/Module/WebDriver.php on line 2434

The error is thrown because of the missing name attribute from the submit input.

I've noticed the issue after updating from v1.4.0 to v2.0.0 (which introduced type safety). My test worked in v1.4.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions