seeInField查找元素,而fillField找不到-CodeCeption [英] seeInField finds the element, while fillField doesn't - CodeCeption
问题描述
我对CodeCeption完全陌生。我体内有下面的html
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>
在CodeCeption接受测试中,我有一个下面的代码
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测试成功通过,但fillField引发错误
seeInField Test passes successfully, but fillField throws an error
对不起,我无法填写字段 #contentId,222397
InvalidArgumentException:当前节点列表为空
这阻止了我继续前进。
This stops me to proceed further. Help me out on this.
推荐答案
最后,我的问题得到了答案。我使用PhpBrowser模块进行测试,该模块不允许用户填写不在表单内的字段。他们在文档中提到的其他内容是
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,
PhpBrowser的常见缺点:
- 您只能单击具有有效网址的链接或表单提交
按钮 - 您不能填写不在a内的字段形式
- 您不能使用JavaScript交互:模式窗口,日期选择器等,
这篇关于seeInField查找元素,而fillField找不到-CodeCeption的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!