seeInField finds the element, while fillField doesn't - CodeCeption

笑着哭i 提交于 2019-12-10 04:23:00

问题


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:

  1. You can click only on links with valid urls or form submit buttons
  2. You can't fill fields that are not inside a form
  3. You can't work with JavaScript interactions: modal windows, datepickers, etc.,


来源:https://stackoverflow.com/questions/24349463/seeinfield-finds-the-element-while-fillfield-doesnt-codeception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!