Skip to content
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
Closed

grabValueFrom doesn't work with fillField #3866

wumouse opened this issue Dec 22, 2016 · 3 comments

Comments

@wumouse
Copy link
Contributor

@wumouse 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
Copy link
Member

@Naktibalda Naktibalda commented Dec 22, 2016

Could you make a pull request?

@wumouse
Copy link
Contributor Author

@wumouse wumouse commented Dec 26, 2016

My pleasure

@wumouse
Copy link
Contributor Author

@wumouse 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 grabValueFrom doesn't work 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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.