Behatch / contexts

Behat extension with most custom helper steps
Other
394 stars 203 forks source link

\Behatch\HttpCall\HttpCallListener::afterStep() can cause Call to a member function source() on null #284

Open WillGibson opened 4 years ago

WillGibson commented 4 years ago

I did a wholesale composer update then started getting...

Call to a member function source() on null

...which happens in \Behat\Mink\Driver\Selenium2Driver::getContent() when \Behat\Mink\Driver\Selenium2Driver::$webDriver is null.

I've done a little thing in a PR (https://github.com/WillGibson/contexts/pull/1/files) just to keep my project moving.

I'm not sure whether the issue is best addressed in \Behatch\HttpCall\HttpCallListener::afterStep() or \Behat\Mink\Driver\Selenium2Driver::getContent() so would welcome some opinion.

miedzikd commented 3 years ago

I have same problem when I added behatch context to my behat config file

extensions:
        Behat\MinkExtension:
           ...
        Behat\Symfony2Extension: ~
        Behatch\Extension: ~

When I remove last line my @javascript tests working well again

robertfausk commented 3 years ago

There is also a PR for this: #292

@miedzikd This problem occures based on implementation of used Behat\Mink\Driver\DriverInterface. E.g. https://github.com/minkphp/MinkSelenium2Driver/blob/36c33585f62ffe1d791c5db838d1457522b3b382/src/Selenium2Driver.php#L485 has no check if $this->wdSession is set or startet.

    public function getContent()
    {
        return $this->wdSession->source();
    }

As a solution you can switch to one of the existing behat panther extensions like https://github.com/robertfausk/behat-panther-extension and discard the slow selenium one :wink: