Skip to content
This repository has been archived by the owner on Apr 20, 2021. It is now read-only.

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

Open
WillGibson opened this issue Apr 1, 2020 · 2 comments

Comments

@WillGibson
Copy link

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
Copy link

miedzikd commented Sep 17, 2020

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 added a commit to robertfausk/mink-panther-driver that referenced this issue Oct 8, 2020
This resolves amongst other things issues with behatch
also see:
Behatch/contexts#284
Behatch/contexts#292
@robertfausk
Copy link

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 😉

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants