dusk: Curl error thrown for http POST

I am dynamicaly creating a browser for each exising user with bellow code snippet.


        $users = User::all();

        foreach($users as $user){

            $this->browse(
                function ( Browser $one ) use ($user)
                {
                    $search = array( 'stock', 'dollar', 'gold', 'market' );
                    $searchString = $search[ rand(0, sizeof($search) - 1 ) ];

                    $one->loginAs($user)
                        ->visit('/home')
                        ->waitForText('Bloomberg News')
                        ->type('search', $searchString );
                }
                );

The test is throwing the bellow error.

php artisan dusk
PHPUnit 6.5.13 by Sebastian Bergmann and contributors.

E                                                                   1 / 1 (100%)

Time: 1.11 minutes, Memory: 14.00MB

There was 1 error:

1) Tests\Browser\ExampleTest::testBasicExample
Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session/d0eec334e467fffaf17d330d553bdbcc/url with params: {"url":"http:\/\/sandbox.com\/home"}

Operation timed out after 30001 milliseconds with 0 bytes received

/home/210390.cloudwaysapps.com/arfyvgtjzf/public_html/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:29
2
/home/210390.cloudwaysapps.com/arfyvgtjzf/public_html/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:547
/home/210390.cloudwaysapps.com/arfyvgtjzf/public_html/vendor/facebook/webdriver/lib/Remote/RemoteExecuteMethod.php:40
/home/210390.cloudwaysapps.com/arfyvgtjzf/public_html/vendor/facebook/webdriver/lib/WebDriverNavigation.php:85
/home/210390.cloudwaysapps.com/arfyvgtjzf/public_html/vendor/laravel/dusk/src/Browser.php:137
/home/210390.cloudwaysapps.com/arfyvgtjzf/public_html/tests/Browser/ExampleTest.php:30
/home/210390.cloudwaysapps.com/arfyvgtjzf/public_html/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:67
/home/210390.cloudwaysapps.com/arfyvgtjzf/public_html/tests/Browser/ExampleTest.php:33

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 8
  • Comments: 39 (13 by maintainers)

Most upvoted comments

Have still the issue…

1) Tests\Browser\AllGuestPagesTest::can_visit_the_explore_page
Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session/3de19f58d2510cd5ae4ce743b4db72ad/url with params: {"url":"http:\/\/instafood.test\/find"}

Operation timed out after 30004 milliseconds with 0 bytes received

/Users/shadrix/Dropbox/Business/insta.food/Website_W_Laravel/instafood/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:292
/Users/shadrix/Dropbox/Business/insta.food/Website_W_Laravel/instafood/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:547
/Users/shadrix/Dropbox/Business/insta.food/Website_W_Laravel/instafood/vendor/facebook/webdriver/lib/Remote/RemoteExecuteMethod.php:40
/Users/shadrix/Dropbox/Business/insta.food/Website_W_Laravel/instafood/vendor/facebook/webdriver/lib/WebDriverNavigation.php:85
/Users/shadrix/Dropbox/Business/insta.food/Website_W_Laravel/instafood/vendor/laravel/dusk/src/Browser.php:138
/Users/shadrix/Dropbox/Business/insta.food/Website_W_Laravel/instafood/tests/Browser/AllGuestPagesTest.php:17
/Users/shadrix/Dropbox/Business/insta.food/Website_W_Laravel/instafood/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:67
/Users/shadrix/Dropbox/Business/insta.food/Website_W_Laravel/instafood/tests/Browser/AllGuestPagesTest.php:19

I even updated ChromeDriver to:

ChromeDriver binaries successfully updated to version 2.45 (Chrome v70-72).

This is happening to us on latest chromedriver + chrome, make all tests super unstable.

I solved the same problem by cleaning up the mess that I did on my Homestead virtual machine. I suggest these steps: Step 1: update all the packages in the distro Step 2: remove chromium-browser, install google-chrome-stable Step 3: kill all chrome/chromium processes Step 4: verify my google-chrome --version (e.g. 80) Step 5: install the correct chrome-driver inside the project via php artisan:dusk chrome-driver 80 Step 6: it works=> php artisan dusk

@mr-feek if you are ubuntu user. follow this steps

  1. go to the YOUR_PROJECT/vendor/laravel/dusk/bin/ and check file permission needs to be 755 as per laravel dusk documentation chromedriver-linux

  2. run ./chromedriver-linux

  3. now you can start test

Here is the my error snip

Curl error thrown for http POST to /session/a9f06bacd23775e734a613f3872e17b4/element/0.6158575831969006-3/value with params: {"value":["Peg2020Bed"]}

@djzara Please create a minimal failing application and upload it to GitHub, I’ll take look at it.

I have the same issue, when changing binary in DuskTestCase::driver function :

$options->setBinary('/snap/bin/chromium');

it seems it’s because of the remote debugging port :

$options = (new ChromeOptions)->addArguments([
     // fix the issue
    '--remote-debugging-port=9222'
]);

if i use /usr/bin/google-chrome instead i don’t need to add the --remote-debugging-port=9222, it seems that chromium remote-debugging-port is mandatory for chromium and not for chrome

@ahmedalarifi this was one of the first thing I tried, as it’s in the documentation. The problem for a lot of us is that even after doing this it still didn’t help. Even so, thanks for the comment 😃

i just found out it worked for me for one time only! after running that command 😃

from the docs https://laravel.com/docs/8.x/dusk#managing-chromedriver-installations

Dusk requires the chromedriver binaries to be executable. If you’re having problems running Dusk, you should ensure the binaries are executable using the following command: chmod -R 0755 vendor/laravel/dusk/bin/.

this solved my problem

Hi,

I’ve encountered the same problem, but after investigations I found that this is a generic error send back if the browser stalls for some reason.

If you remove your --headless parameter from your DuskTestCase.php you will be able to see the test browser progress. Monitoring this I noticed in my situation, that even though the page seems to be loaded, the fonts were not loaded, and tab progress spinner was still on - indicating page is still loaded.

I opened in the test-browser the development tools and saw that one of the requests at was still pending.: image

So I’ve tried to access it directly : https://fonts.googleapis.com/css2?family=Montserrat&family=Muli:wght@500;800&display=swap

and noticed that he test-browser had problems loading these fonts.

I’ve been using a company VPN this whole time, and decided to try without it. WORKED like a charm.

So apparently in my situation, the error was given by a possible proxy restriction to the googleapi, which made the test-browser wait too much for the page to finish loading.

My solution for my situation was to either test without VPN, or, to download your online dependent resources locally: some guide

I hope this will help someone… Cheers!