Skip to content

Webdriver curl exception #155

Closed
Closed
@tomgscs

Description

@tomgscs

My suit of tests crashes each time at the same step with an error like this :

Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session/27b6f2965e805dfbf342c5d7da3eec08/element/0.3235364760108057-3/click

Operation timed out after 30005 milliseconds with 0 bytes received

I've tried in headless, no headless, sandbox, no sandbox... Finally, if I start a php webserver php -S -t /web and I put manually the uri in Client::createChromeClient method, it works.

Activity

robertfausk

robertfausk commented on Dec 24, 2018

@robertfausk
Contributor

I had the same issue and could resolve it by removing listener from https://github.com/dmaicher/doctrine-test-bundle in phpunit.xml.dist:

<?xml version="1.0" encoding="UTF-8"?>

<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.1/phpunit.xsd"
         backupGlobals="false"
         colors="true"
         bootstrap="vendor/autoload.php"
>
    <php>
        <ini name="error_reporting" value="-1" />
        <env name="KERNEL_CLASS" value="App\Kernel" />
        <env name="APP_ENV" value="test" />
        <env name="APP_DEBUG" value="1" />
        <env name="PROJECT_NAME" value="my_team_app" />
        <env name="DATABASE_URL" value="sqlite://%kernel.cache_dir%/test.db" />
        <env name="APP_SECRET" value="s$cretf0rt3st" />
        <!-- define your env variables for the test env here -->
    </php>

    <extensions>
        <extension class="Symfony\Component\Panther\ServerExtension" />
    </extensions>

    <listeners>
        <listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
        <!--<listener class="\DAMA\DoctrineTestBundle\PHPUnit\PHPUnitListener" />-->
    </listeners>

    <testsuites>
        <testsuite name="Project Test Suite">
            <directory>tests/</directory>
        </testsuite>
    </testsuites>
</phpunit>

I didn't investigate further because it is now working for me. Hope it helps.

azjezz

azjezz commented on Feb 6, 2019

@azjezz

having the same error while using panther.

PHP Fatal error:  Uncaught Facebook\WebDriver\Exception\WebDriverCurlException: 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 30000 milliseconds with 0 bytes received in /home/saif/projects/scpr/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:292
Stack trace:

#0 /home/saif/projects/scpr/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php(126): 
Facebook\WebDriver\Remote\HttpCommandExecutor->execute(Object(Facebook\WebDriver\Remote\WebDriverCommand))

#1 /home/saif/projects/scpr/vendor/symfony/panther/src/ProcessManager/ChromeManager.php(59):
Facebook\WebDriver\Remote\RemoteWebDriver::create('http://127.0.0....', Object(Facebook\WebDriver\Remote\DesiredCapabilities))

#2 /home/saif/projects/scpr/vendor/symfony/panther/src/Client.php(80): 
Symfony\Comp in /home/saif/projects/scpr/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php on line 292
metaer

metaer commented on Mar 18, 2019

@metaer
Contributor

Look this

And this:

return RemoteWebDriver::create($url, $capabilities);

And this

4-th argument in RemoteWebDriver::create is $request_timeout_in_ms
But there is no way to increase it without edit library code

My temporary solution is to replace

return RemoteWebDriver::create($url, $capabilities);

in \Symfony\Component\Panther\ProcessManager\ChromeManager::start

with

return RemoteWebDriver::create($url, $capabilities, null, 600000);

It works for me. Before this I could not use xdebug because of slow script execution.

smolpl

smolpl commented on Dec 19, 2019

@smolpl

Same issue for me.
Workaround with timeout options does not help.

My temporary solution is to call self::stopWebServer(); in first failing test.

public function testFoo(): void
{
    self::stopWebServer();

    $client = static::createPantherClient();

    //...
}
shubaivanqbee

shubaivanqbee commented on Aug 13, 2021

@shubaivanqbee

Hi, maybe ritgh now it's not actual, but I resolved this problem like this

        $this->panterClient = static::createPantherClient([
            '--remote-debugging-port=9222',
            '--no-sandbox',
        ], [], ['request_timeout_in_ms'=>20000000]);
arderyp

arderyp commented on Apr 6, 2022

@arderyp
Contributor

Unfortunately, I'm experiencing the same problem, and none of the suggestions above seem to work.

Php: 7.4.28
Panther: v1.1.2
dbrekelmans/bdi: 1.0
ChromeDriver (via bdi): 100.0.4896.60
Symfony: 4.4.37

caponica

caponica commented on Dec 2, 2022

@caponica

I have the same problem. Could somebody explain why it's trying to POST to /session in the first place?

I'm using Panther to scrape a third party website, so it should not be trying to make any local calls at all, right?

Confusingly, everything works on my local windows dev machine, but is failing with this session POST timeout when I try to run it on the ubuntu production server.

After the script runs I also get an error at the end (from the destructor?) which looks something like this:
PHP Fatal error: Uncaught Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http DELETE to /session/548e92ad-...

Is there any way to configure panther not to try making these session calls (which appear to be local) when using it to scrape a remote site?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @smolpl@caponica@robertfausk@metaer@arderyp

      Issue actions

        Webdriver curl exception · Issue #155 · symfony/panther