【问题标题】:fillField method in codeception not working throwing DOMXPath::query(): Invalid expressioncodeception 中的 fillField 方法不起作用抛出 DOMXPath::query(): Invalid expression
【发布时间】:2014-05-23 19:12:26
【问题描述】:

$I->fillField("username", "test");

在运行验收测试时,出现以下错误:

抱歉,我无法填写“用户名”、“测试”字段: ErrorException: DOMXPath::query(): 无效的表达式

输入元素在表单内。我尝试将 id 添加到输入并使用 inpu 访问元素。但都返回了相同的错误。 “see” 方法正在工作..但不是 fillField 或 seeInField。

【问题讨论】:

标签: codeception


【解决方案1】:

你必须告诉 codeception 它在寻找什么元素。

如果用户名是 id 则:

$I->fillField("#username", "test");

如果一个班级这样做:

$I->fillField(".username", "test");

或输入元素的 xpath:(例如 google.com 上的搜索字段)

$I->fillfield('//*[@id="gbqfq"]','my search text test');

【讨论】:

    猜你喜欢
    • 2021-02-02
    • 2022-06-28
    • 1970-01-01
    • 2014-11-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-09
    相关资源
    最近更新 更多