【问题标题】:Call to undefined method AcceptanceTester::getModule调用未定义的方法 AcceptanceTester::getModule
【发布时间】:2016-08-04 09:05:03
【问题描述】:

这是我的代码 -

<?php
class ClassiDescCest{
        public function desc(AcceptanceTester $I){
            $classifications = $this->getModule('WebDriver')->_findElements('/html/body/div[1]/div/section/div/div/div/div/div[2]/div[2]/div[1]/div/div/span/a/span');
            echo $classifications.size();

        }
}

这是我得到的错误 - Error for undefined method

【问题讨论】:

  • $classifications.size();看起来像 Javascript 代码,PHP 方式是 count($classifications);

标签: codeception


【解决方案1】:

$this-&gt;getModule() 不能在 Cest 文件中使用,

_findElements 是一种隐藏方法,只能在 http://codeception.com/docs/06-ModulesAndHelpers 中记录的帮助程序中使用

同时检查 grabMultiple 方法是否满足您的需求。

【讨论】:

  • 感谢您的回复。 grabMulptiple() 为我工作。
猜你喜欢
  • 2019-11-23
  • 1970-01-01
  • 2012-07-27
  • 2019-10-25
  • 2018-07-11
  • 2013-10-23
  • 2012-02-17
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多