php Codeception不那么快开始:[PHPUnit \ Framework \ Exception]未定义的索引:ELEMENT

So, I followed the Codeception Quick Start instructions faithfully. I run the first example test using the PhpBrowser...

# Codeception Test Suite Configuration
#
# [further comments omitted]
# 
actor: AcceptanceTester
modules:
    enabled:
        - PhpBrowser:
            url: 'http://office.localhost/'
            browser: 'firefox'
        - \Helper\Acceptance

and the test:

<?php

class FirstCest
{               
    public function frontpageWorks(AcceptanceTester $I)
    {
        $I->amOnPage('/');
        $I->see('We hope you enjoy it');

    }
}

and all is well.

Then I change the configuration to this:

actor: AcceptanceTester
modules:
    enabled:
        - WebDriver:
            url: 'http://office.localhost/'
            browser: 'firefox'
        - \Helper\Acceptance

per the instructions, and I have Selenium installed and up and running, and away we go...

1) FirstCest: Frontpage works
 Test  tests/acceptance/FirstCest.php:frontpageWorks

  [PHPUnit\Framework\Exception] Undefined index: ELEMENT  


Scenario Steps:

 2. $I->see("InterpretersOffice") at tests/acceptance/FirstCest.php:22
 1. $I->amOnPage("/") at tests/acceptance/FirstCest.php:21

#1  /opt/www/court-interpreters-office/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:198
#2  Codeception\Module\WebDriver->see
#3  /opt/www/court-interpreters-office/tests/_support/_generated/AcceptanceTesterActions.php:363
#4  /opt/www/court-interpreters-office/tests/acceptance/FirstCest.php:22
#5  FirstCest->frontpageWorks

Selenium is driving Firefox, the page is loaded, the content that $I want to see() is there, so that ain't the problem. I have poked around in the source a bit, but haven't figured this out. I have tried changing $I->see() to $I->seeInSource() and found that does work, FWIW.

Any thoughts?

The problem is apparently that Facebook's php-webdriver isn't compatible with current Firefox.

These threads discuss the issue in more detail, and php-webdriver issue #469 tracks adding full W3C WebDriver support (which will fix the incompatibility).

A workaround is to add the -enablePassthrough false argument when launching Selenium. For example:

java -Dwebdriver.gecko.driver=./geckodriver -jar selenium-server-standalone-3.8.1.jar -enablePassThrough false

Unfortunately, Selenium removed support for pass through mode in 3.9, so you'll have to use an older version.

Another workaround is to switch to Chrome.

In my case the only solution was:

Install chromedriver in a path that is in $PATH (/usr/bin or /bin)

and using in your test class:

$capabilities = DesiredCapabilities::chrome()

It works with executing Selenium standard way:

 java -jar selenium-server-standalone-3.14.0.jar