无法选择我的字段,也无法用codeception编写

问题描述 投票:0回答:1

我正在尝试编写一个小测试,我登录到我选择的页面。我想将我的电子邮件地址写入登录字段,然后按按钮登录。但是,我收到一个错误,我在fillField函数中错过了参数。

[ArgumentCountError]函数AcceptanceTester :: fillField()的参数太少,1在第11行的C:\ Users \ Henrikas \ tests \ acceptance \ LoginCest.php中传递,正好是2个预期

这是我的代码:public function successTest(AcceptanceTester $ I)

 {

        $I->wantTo("Created test case for login");
        $I->amOnPage('page');
        $I->fillField(['input' => '.form-control', "myEmailAddress"]);
        $I->click("//button[@class='btn btn-primary btn-block btn-rounded text-uppercase']");
}
}

和错误图片:enter image description here

来自我网站的HTML代码:qazxsw poi

php testing composer-php automated-tests codeception
1个回答
0
投票

enter image description here代码方法采用类型为字符串1的两个参数。选择器2.值

在这两种情况下都提供了一个数组。您可能希望像这样使用xpath编写测试用例

fillField

取决于按钮元素的方式。

© www.soinside.com 2019 - 2024. All rights reserved.