【问题标题】:seeInField finds the element, while fillField doesn't - CodeCeptionseeInField 找到元素,而 fillField 没有 - CodeCeption
【发布时间】:2014-06-22 08:26:26
【问题描述】:

我对 CodeCeption 完全陌生。我在正文中有以下 html,

<div><input type="text" name="content_id" id="contentId" maxlength="10" value="123"></div>

在 CodeCeption 验收测试中,我有一个下面的代码

`<?php 
$I = new AcceptanceTester($scenario);
$I->wantTo('fillfield test');
$I->amOnPage('/');
$I->seeInField('#contentId', 123);
$I->fillField('#contentId', 222397);
?>`

seeInField测试成功通过,但是fillField抛出错误

抱歉,我无法填写“#contentId”字段,222397
InvalidArgumentException:当前节点列表为空

这阻止了我继续前进。帮我解决这个问题。

【问题讨论】:

    标签: php unit-testing acceptance-testing codeception


    【解决方案1】:

    终于得到了我自己问题的答案。我使用 PhpBrowser 模块进行测试,它不允许用户填写不在表单内的字段。他们在文档中提到的其他内容是,

    常见的 PhpBrowser 缺点:

    1. 您只能单击具有有效 URL 的链接或表单提交 按钮
    2. 您不能填写不在表单内的字段
    3. 您不能使用 JavaScript 交互:模式窗口、日期选择器等,

    【讨论】:

    • 使用 Codeception 进行 JS 交互的解决方案是什么?
    • 谢谢。我试图在没有表单的情况下填写输入字段。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多