问题
I am totally new to CodeCeption. I have the below html inside the body,
<div><input type="text" name="content_id" id="contentId" maxlength="10" value="123"></div>
In CodeCeption acceptance test I have a this below code
`<?php
$I = new AcceptanceTester($scenario);
$I->wantTo('fillfield test');
$I->amOnPage('/');
$I->seeInField('#contentId', 123);
$I->fillField('#contentId', 222397);
?>`
seeInField Test passes successfully, but fillField throws an error
Sorry, I couldn't fill field "#contentId", 222397
InvalidArgumentException: The current node list is empty
This stops me to proceed further. Help me out on this.
回答1:
Finally got answer to my own question. I used PhpBrowser module for testing, it won't allow the user to fill fields which are not inside the form. And other stuffs they mentioned in the Docs are,
Common PhpBrowser drawbacks:
- You can click only on links with valid urls or form submit buttons
- You can't fill fields that are not inside a form
- You can't work with JavaScript interactions: modal windows, datepickers, etc.,
来源:https://stackoverflow.com/questions/24349463/seeinfield-finds-the-element-while-fillfield-doesnt-codeception