seeInField查找元素,而fillField找不到-CodeCeption [英] seeInField finds the element, while fillField doesn't - CodeCeption

查看:116
本文介绍了seeInField查找元素,而fillField找不到-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的常见缺点:


  1. 您只能单击具有有效网址的链接或表单提交
    按钮

  2. 您不能填写不在a内的字段形式

  3. 您不能使用JavaScript交互:模式窗口,日期选择器等,

这篇关于seeInField查找元素,而fillField找不到-CodeCeption的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆