eronn
eronn

Reputation: 1840

Symfony 5 - PhpUnit Panther : This version of ChromeDriver only supports Chrome version 80

I am trying to use Panther with PhpUnit, it looks OK, but when I try to log a user like this

        $client = static::createPantherClient();

        /** @var User $user */
        $user = $this->getSuperAdminAccount();

        $session = self::$container->get('session');

        $token = new UsernamePasswordToken($user, null, 'main', $user->getRoles());
        $session->set('_security_main', serialize($token));
        $session->save();

        $cookie = new Cookie($session->getName(), $session->getId());
        $client->getCookieJar()->set($cookie);

And I launch the test, I've the following error :

Facebook\WebDriver\Exception\SessionNotCreatedException : session not created: This version of ChromeDriver only supports Chrome version 80

And I've the latest chrome version :

enter image description here

But Panther does not allow the use of the chromeDriver associated with our version of Chrome. So I don't really see what I can do

Upvotes: 2

Views: 1500

Answers (2)

bechir
bechir

Reputation: 459

For someone who got the same error, this is what I did:

  • Add PANTHER_CHROME_DRIVER_BINARY=./chromedriver in .env.test
  • Run tests

If you are in Mac you may be noticed that “chromedriver” cannot be opened because the developer cannot be verified. Simply enable it in your system preferences.

Upvotes: 1

Manzolo
Manzolo

Reputation: 1959

This is my configuration:

composer show symfony/panther                  
name     : symfony/panther
descrip. : A browser testing and web scraping library for PHP and Symfony.
keywords : e2e, scraping, selenium, symfony, testing, webdriver
versions : * v0.7.1

Version 0.7.1 of symfony/panther has chromedriver 80.*, this is the problem.

There is an opened issue: https://github.com/symfony/panther/issues/356

we need the updated version

EDIT: Temporary workaround for dev environment:

CHROME_MAIN_VERSION=`google-chrome-stable --version | sed -E 's/(^Google Chrome |\.[0-9]+ )//g'`
CHROMEDRIVER_VERSION=`curl -s "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROME_MAIN_VERSION"`
curl "https://chromedriver.storage.googleapis.com/${CHROMEDRIVER_VERSION}/chromedriver_linux64.zip" -O
unzip chromedriver_linux64.zip -d ./${projectpath}/vendor/symfony/panther/chromedriver-bin
mv ./${projectpath}/vendor/symfony/panther/chromedriver-bin/chromedriver ./${projectpath}/vendor/symfony/panther/chromedriver-bin/chromedriver_linux64

Upvotes: 1

Related Questions