Skip to content

PhpBrowser's submitForm() is not submitting empty $button correctly #4477

@ThomasLandauer

Description

@ThomasLandauer

When submitting a form as shown in the example at http://codeception.com/docs/modules/PhpBrowser#submitForm

$I->submitForm(
    '#userForm',
    [
        'user' => [
            'login' => 'Davert',
            'password' => '123456',
            'agree' => true
        ]
    ],
    'submitButton'
);

... the submitButton gets submitted as "submitButton":null. (This is probably due to the fact that I'm using a <button> rather than an <input type="submit"> - so the button itself doesn't have a value.) The problem is that now Symfony doesn't recognize the button as being clicked, since it expects different data (which is how real browsers do it): "submitButton":"".

So I would suggest:

  • Either accept an array as the $button parameter of submitForm() like this: array('submitButton'=>'')
  • Or (preferably): If the element doesn't have a value, just submit the empty string '' instead of null

Details

  • Codeception version: 2.3.5
  • PHP Version: 7.1

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