contexts icon indicating copy to clipboard operation
contexts copied to clipboard

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

Open WillGibson opened this issue 5 years ago • 2 comments

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.

WillGibson avatar Apr 01 '20 17:04 WillGibson

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

miedzikd avatar Sep 17 '20 07:09 miedzikd

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:

robertfausk avatar Oct 08 '20 15:10 robertfausk