panther: [Question] Web Driver Curl Exception - docker

Hi everyone,

I try to run Panther on a new installation of Symfony (4.2). I have this error message when I start my tests :

1) App\Tests\Controller\HomeControllerTest::testIndex
Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session with params: {"desiredCapabilities":{"browserName":"chrome","platform":"ANY"}}

Operation timed out after 30002 milliseconds with 0 bytes received

/srv/myproject/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:292
/srv/myproject/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:126
/srv/myproject/vendor/symfony/panther/src/ProcessManager/ChromeManager.php:59
/srv/myproject/vendor/symfony/panther/src/Client.php:80
/srv/myproject/vendor/symfony/panther/src/Client.php:272
/srv/myproject/vendor/symfony/panther/src/Client.php:186
/srv/myproject/tests/Controller/HomeControllerTest.php:15

My Dockerfile:

FROM php:latest

RUN apt-get update && apt-get install -y libzip-dev zlib1g-dev chromium && docker-php-ext-install zip

My test:

class HomeControllerTest extends PantherTestCase
{
    public function testIndex()
    {
        $client = static::createPantherClient();

        $crawler = $client->request('GET', '/');

        $this->assertCount(1, $crawler->filter('h1'));
    }
}

PS: I followed the recommended installation

Thanks for the help 😃

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 23 (3 by maintainers)

Most upvoted comments

On my side I get an error on destruct:

PHP Fatal error:  Uncaught Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http DELETE to /session/9dc6a482f043c2bc5bd06d67a38f85eb

Failed to connect to 127.0.0.1 port 9515: Connection refused in /srv/app/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:292
Stack trace:
#0 /srv/app/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php(547): Facebook\WebDriver\Remote\HttpCommandExecutor->execute(Object(Facebook\WebDriver\Remote\WebDriverCommand))
#1 /srv/app/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php(289): Facebook\WebDriver\Remote\RemoteWebDriver->execute('quit')
#2 /srv/app/vendor/symfony/panther/src/Client.php(340): Facebook\WebDriver\Remote\RemoteWebDriver->quit()
#3 /srv/app/vendor/symfony/panther/src/Client.php(76): Symfony\Component\Panther\Client->quit()
#4 [internal function]: Symfony\Component\Panther\Client->__destruct()
#5 {main}
  thrown in /srv/app/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php on line 292

If anyone got this error let me know please 😄

@nicoweb I played a bit and i came with a quick workaround. You have to add the “–no-sandbox” option to your client. It prevent the timeout to happen.

You can do it like this :

        $options = [
            '--headless',
            '--window-size=1200,1100',
            '--no-sandbox',
            '--disable-gpu'
        ];
        
        $client = Client::createChromeClient(null, $options, [], 'http://your_uri');
        $crawler = $client->request('GET', '/your_test_url');

        //do your tests

Tell me if it works

@qdequippe Exactly ! I was trying to make my own usage of panther. Using directly stuff in this Trait solve all my problem.

I have the same issue an not in docker Debian 9

Curl error thrown for http POST to /session with params: {"desiredCapabilities":{"browserName":"chrome","platform":"ANY","chromeOptions":{"binary":"","args":["--headless","--window-size=1200,1100","--disable-gpu"]}}}

Operation timed out after 30001 milliseconds with 0 bytes received

when I changed execution time https://github.com/symfony/panther/issues/155#issuecomment-474011523 now I have error

\PHP Fatal error:  Uncaught Facebook\WebDriver\Exception\UnknownServerException: unknown error: Chrome failed to start: exited abnormally
  (Driver info: chromedriver=2.37.544315 (730aa6a5fdba159ac9f4c1e8cbc59bf1b5ce12b7),platform=Linux 4.9.0-8-amd64 x86_64) in /media/sf_prnt/vendor/facebook/webdriver/lib/Exception/WebDriverException.php:114
Stack trace:
#0 /media/sf_prnt/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php(326): Facebook\WebDriver\Exception\WebDriverException::throwException(13, 'unknown error: ...', Array)
#1 /media/sf_prnt/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php(126): Facebook\WebDriver\Remote\HttpCommandExecutor->execute(Object(Facebook\WebDriver\Remote\WebDriverCommand))
#2 /media/sf_prnt/vendor/symfony/panther/src/ProcessManager/ChromeManager.php(62): Facebook\WebDriver\Remote\RemoteWebDriver::create('http://127.0.0....', Object(Facebook\WebDriver\Remote\DesiredCapabilities), 600000, 600000)
#3 /media/sf_prnt/vendor/symfony/panther/src/Client.php(82): Symfony\Component\Panther\Pro in /media/sf_prnt/vendor/facebook/webdriver/lib/Exception/WebDriverException.php on line 114

Do I need any Desktop installed to use Panther?

I assumed something like this, but wanted to make shure I don’t miss a possible hint. But this leaves the problem still open. The call to $client->request() currently times out after 30s.