Codeception / module-webdriver

WebDriver module for Codeception

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`submitForm` throws `TypeError` for input fields without `name` attribute

dahaupt opened this issue · comments

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.