Skip to content

grabValueFrom doesn't work with fillField #3866

Closed

Description

@wumouse

test code is:

$I->fillField('username', 'admin');
codecept_debug($I->grabValueFrom('[name=username]'));
$I->click('Login');

run with --debug option, will get output like:

   I grab value from "[name=username]"
  
   I click "Login"

no value ouputed here. notice that the empty line is my expected output location of value.

I found the issue in last line of method CodeCeption\Lib\InnerBrowser::fillField:

$input->getNode(0)->nodeValue = htmlspecialchars($value);

the point is input field must be have no nodeValue, and grabValueFrom use the right way to get value. I think the right code should be like:

$input->getNode(0)->setAttribute('value', htmlspecialchars($value));

I tried to change to this, it works

I think a test for CodeCeption\Lib\InnerBrowser will be good.

Activity

  1. Naktibalda commented on Dec 22, 2016

    @Naktibalda
    Member

    Could you make a pull request?

  2. wumouse commented on Dec 26, 2016

    @wumouse
    ContributorAuthor

    My pleasure

  3. wumouse commented on Dec 26, 2016

    @wumouse
    ContributorAuthor

    #3873 PR created

  4. added a commit that references this issue on Dec 28, 2016
    8b45ec4
  5. changed the title [-]grabValueFrom doesn't work[/-] [+]grabValueFrom doesn't work with fillField[/+] on Dec 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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