Search code examples
codeception

Call to undefined method AcceptanceTester::getModule


Here is my code -

<?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();

        }
}

Here is the error that I am getting - Error for undefined method


Solution

  • $this->getModule() can't be used in the Cest file,

    _findElements is a hidden method and can only be used in helpers as documented in http://codeception.com/docs/06-ModulesAndHelpers

    Also check if grabMultiple method does what you need.