New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grabValueFrom doesn't work with fillField #3866

Closed
wumouse opened this Issue Dec 22, 2016 · 3 comments

Comments

Projects
None yet
2 participants
@wumouse
Contributor

wumouse commented Dec 22, 2016

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.

@Naktibalda

This comment has been minimized.

Show comment
Hide comment
@Naktibalda

Naktibalda Dec 22, 2016

Member

Could you make a pull request?

Member

Naktibalda commented Dec 22, 2016

Could you make a pull request?

@wumouse

This comment has been minimized.

Show comment
Hide comment
@wumouse

wumouse Dec 26, 2016

Contributor

My pleasure

Contributor

wumouse commented Dec 26, 2016

My pleasure

@wumouse

This comment has been minimized.

Show comment
Hide comment
@wumouse

wumouse Dec 26, 2016

Contributor

#3873 PR created

Contributor

wumouse commented Dec 26, 2016

#3873 PR created

wumouse added a commit to wumouse/Codeception that referenced this issue Dec 28, 2016

@wumouse wumouse changed the title from grabValueFrom doesn't work to grabValueFrom doesn't work with fillField Dec 28, 2016

@Naktibalda Naktibalda closed this Dec 30, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment