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\WebDriverException\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
```
What versions of Dusk and Chrome are you using? What's the result of vendor/laravel/dusk/bin/chromedriver-linux --v?
I have laravel 5.5 and I have installed dusk from composer so it should be 5.5 ?
php artisan --version
Laravel Framework 5.5.44
ChromeDriver :
vendor/laravel/dusk/bin/chromedriver-linux --v
ChromeDriver 2.35.528139 (47ead77cb35ad2a9a83248b292151462a66cd881)
What version of Chrome are you using?
Has this test been working before? Are other Dusk tests working?
@staudenmeir I have posted the output of my vendor/laravel/dusk/bin/chromedriver-linux --v above that's the Chrome you are asking about ?
Now I got it work with a basic snippet from the laravel manual https://laravel.com/docs/5.5/dusk
This is not bad but I will have to hard code a test case for each user and the point is to load the test dynamically for each user extracted from DB;
```
$this->browse(
function ( $one )
{
$search = array( 'stock', 'dollar', 'gold', 'market' );
$searchString = $search[ rand(0, sizeof($search) - 1 ) ];
$one->loginAs(User::find(1))
->visit('/home')
->waitForText('Bloomberg News')
->type('search', $searchString );
}
```
That was the ChromeDriver version.
The test with $one->loginAs(User::find(1)) is working?
yes
Now I have tried to hard code it and it stuck again :
$this->browse(
function ( $one, $two, $three, $four, $five, $six )
{
$search = array( 'stock', 'dollar', 'gold', 'market' );
$searchString = $search[ rand(0, sizeof($search) - 1 ) ];
$one->loginAs(User::find(1))
->visit('/home')
->waitForText('Bloomberg News')
->type('search', $searchString );
$two->loginAs(User::find(2))
->visit('/home')
->waitForText('Bloomberg News')
->type('search', $searchString );
$three->loginAs(User::find(15))
->visit('/home')
->waitForText('Bloomberg News')
->type('search', $searchString );
$four->loginAs(User::find(19))
->visit('/home')
->waitForText('Bloomberg News')
->type('search', $searchString );
$five->loginAs(User::find(27))
->visit('/home')
->waitForText('Bloomberg News')
->type('search', $searchString );
$six->loginAs(User::find(28))
->visit('/home')
->waitForText('Bloomberg News')
->type('search', $searchString );
}
);
php artisan dusk
PHPUnit 6.5.13 by Sebastian Bergmann and contributors.
E 1 / 1 (100%)
Time: 33.39 seconds, Memory: 12.00MB
There was 1 error:
1) Tests\Browser\ExampleTest::testBasicExample
Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session/95be56c3177dceb5853cc849632e78e7/url with params: {"url":"http:\/\/agora.iotaf.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:292
/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:26
/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:54
ERRORS!
Tests: 1, Assertions: 0, Errors: 1.
Does this work?
$this->browse(
function ( $one)
{
$search = array( 'stock', 'dollar', 'gold', 'market' );
$searchString = $search[ rand(0, sizeof($search) - 1 ) ];
$one->loginAs(User::find(1))
->visit('/home')
->waitForText('Bloomberg News')
->type('search', $searchString );
}
);
$this->browse(
function ( $one)
{
$search = array( 'stock', 'dollar', 'gold', 'market' );
$searchString = $search[ rand(0, sizeof($search) - 1 ) ];
$one->loginAs(User::find(2))
->visit('/home')
->waitForText('Bloomberg News')
->type('search', $searchString );
}
);
Non
1) Tests\Browser\ExampleTest::testBasicExample
Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session/94865ccec813376be37d31e3fc8eb8f9/url with params: {"url":"http:\/\/sandbox.com\/home"}
I am hesitating to open a ticket for my provider but it doesn't look like their system fault.
@driesvints
The Laravel and Chrome driver version has been provided the code in question is in the description. What more infos do you need ?
Why does one error contain http:\/\/agora.iotaf.com\/home and the others http:\/\/sandbox.com\/home?
@ronlinet I just tagged the issue with a "needs more info" label to indicate the ongoing discussion between you and @staudenmeir. I'll tag it as a bug once it has been identified as such.
I get this issue time to time in one project where we have huge number of requests going. issue is either client side networking or server is not responding as its busy.
Closing this issue because it's inactive, already solved, old or not relevant anymore. Feel free to reply if you're still experiencing this issue.
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).
I'm having this issue when running on Travis-CI, but not locally. However, I have before had it locally and fixed it by altering a few settings. When running locally these days after updates I receive the "cannot find element" error that is also reported sometimes.
Here is the error spit out by Travis
1) Tests\Browser\Views\HomePageTest::testHomePage
Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session/77f3913758fa3d3e97031ad321cd6ad8/url with params: {"url":"http:\/\/127.0.0.1:8000"}
Operation timed out after 30001 milliseconds with 0 bytes received
/home/travis/build/djzara/fronds/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:292
/home/travis/build/djzara/fronds/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:547
/home/travis/build/djzara/fronds/vendor/facebook/webdriver/lib/Remote/RemoteExecuteMethod.php:40
/home/travis/build/djzara/fronds/vendor/facebook/webdriver/lib/WebDriverNavigation.php:85
/home/travis/build/djzara/fronds/vendor/laravel/dusk/src/Browser.php:138
/home/travis/build/djzara/fronds/vendor/laravel/dusk/src/Browser.php:159
/home/travis/build/djzara/fronds/tests/Browser/Views/HomePageTest.php:22
/home/travis/build/djzara/fronds/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:67
/home/travis/build/djzara/fronds/tests/Browser/Views/HomePageTest.php:24
As well as my current .travis.yml file
sudo: required
language: php
dist: trusty
php:
- 7.2
addons:
chrome: stable
install:
- cp .env.testing .env
- travis_retry composer install --no-interaction --prefer-dist --no-suggest
- travis_retry npm install
- npm run prod
- php artisan key:generate
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- ./vendor/laravel/dusk/bin/chromedriver-linux &
- google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
- php artisan serve &
script:
- php artisan dusk
And a sample of one of my tests that I've kept basic for the very purpose of setting this up on Travis
public function testHeaderContainer() : void {
$this->browse(function(Browser $browser) {
$browser->visitRoute('fronds.home')
->assertPresent('@fronds-header-cont');
});
}
So far I've tried the original testing snippet from the Laravel Dusk documentation, some samples from around the internet, as well as my own tweaks and trials to see what could be going on.
I'm happy to provide any additional info if needed
@djzara What does your .env.testing file look like?
@staudenmeir
It's tripped down to the bare minimum
APP_NAME=Fronds
APP_ENV=testing
APP_KEY=
APP_DEBUG=false
APP_URL=http://127.0.0.1:8000
DB_CONNECTION=mysql
DB_HOST=192.168.33.10
DB_PORT=3306
DB_DATABASE=fronds
CACHE_DRIVER=array
SESSION_DRIVER=array
SESSION_LIFETIME=120
@djzara What version of Dusk are you using? Have you tried the configuration from the documentation?
The configuration from the docs was copy pasted for my first run through, although to be fair I wouldn't be averse to trying again after some other tweaks.
Actual version:
Laravel Framework 5.7.19
"laravel/dusk": "^4.0",
@djzara Please try the configuration from the documentation, it works for me.
Sorry, I'm still having this issue. For the sake of full review, I'll post exactly what I have, just to triple check
.travis.yml
language: php
php:
- 7.3
addons:
chrome: stable
install:
- cp .env.testing .env
- travis_retry composer install --no-interaction --prefer-dist --no-suggest
- php artisan key:generate
before_script:
- google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
- php artisan serve &
script:
- php artisan dusk
dusk test
public function testHomePage() : void {
$this->browse(function (Browser $browser) {
$browser->visitRoute('fronds.home')
->assertSee('A link');
});
}
.env.testing
APP_NAME=Fronds
APP_ENV=testing
APP_KEY=
APP_DEBUG=false
APP_URL=http://127.0.0.1:8000
DB_CONNECTION=mysql
DB_HOST=192.168.33.10
DB_PORT=3306
DB_DATABASE=fronds
BROADCAST_DRIVER=log
CACHE_DRIVER=array
QUEUE_CONNECTION=sync
SESSION_DRIVER=array
SESSION_LIFETIME=120
Screenshot of the error for that test directly from travis

Any help here is greatly appreciated, been scratching my head on it all day.
@djzara Please create a minimal failing application and upload it to GitHub, I'll take look at it.
So here's what I was able to determine roughly with trying to make a min repro:
.env.testing in the original app has
APP_NAME=Fronds
APP_ENV=testing
APP_KEY=
APP_DEBUG=false
APP_URL=http://127.0.0.1:8000
DB_CONNECTION=mysql
DB_HOST=192.168.33.10
DB_PORT=3306
DB_DATABASE=fronds
BROADCAST_DRIVER=log
CACHE_DRIVER=array
QUEUE_CONNECTION=sync
SESSION_DRIVER=array
SESSION_LIFETIME=120
but in the min app
APP_NAME=Laravel
APP_ENV=testing
APP_KEY=
APP_DEBUG=false
APP_URL=http://127.0.0.1:8000
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
The basic settings in the testing file made the difference. I think the behavior is sane, it's just not inherently obvious as to why that would happen. When I applied this idea to my main app, it worked just fine
Thanks so much for the help!
Since the latest Chrome version, I am having the same issue on my Mac.
Curl error thrown for http DELETE to /session/e1fa458ae28d2aae2e5ab18f2730c574
Operation timed out after 30004 milliseconds with 0 bytes received
Any idea on how I can make this work?
./vendor/laravel/dusk/bin/chromedriver-mac --v outputs ChromeDriver 74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29})
laravel/dusk version v5.1.0
laravel/framework version v5.7.28
Chrome version: 74.0.3729.131
EDIT: It seems that this is a problem only for the --headless parameter. When I remove the headlesss parameter, it works correctly. Yes, I see Chrome popping up but at least I can write my tests.
I'm running into this as well, even not in headless mode
laravel/dusk v5.5.0
chrome driver version 76.0.3809.126
1) Tests\Browser\Orbit\PlanPurchaseTest::test_floating_service
Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session/0bc359709590ca1b6553fe8a6f34b048/element/0.15168393019413462-1/value with params: {"value":["5136333333333335"]}
Operation timed out after 30004 milliseconds with 0 bytes received
/Users/fiachra/repos/billing/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:297
/Users/fiachra/repos/billing/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:561
/Users/fiachra/repos/billing/vendor/facebook/webdriver/lib/Remote/RemoteExecuteMethod.php:40
/Users/fiachra/repos/billing/vendor/facebook/webdriver/lib/Remote/RemoteWebElement.php:332
/Users/fiachra/repos/billing/vendor/laravel/dusk/src/Concerns/InteractsWithElements.php:142
@mr-feek if you are ubuntu user. follow this steps
go to the YOUR_PROJECT/laravel/dusk/bin/ and check file permission needs to be 755 as per laravel dusk documentation chromedriver-linux
run ./chromedriver-linux
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"]}
1. go to the YOUR_PROJECT/laravel/dusk/bin/ and check file permission needs to be 755 as per laravel dusk documentation `chromedriver-linux` 2. run ./chromedriver-linux
It's YOUR_PROJECT/vendor/laravel/dusk/bin/, but yeah, your solution does work for me. Still, I am not sure why is it so, and why won't it work without it as it did and as it should?
1. go to the YOUR_PROJECT/laravel/dusk/bin/ and check file permission needs to be 755 as per laravel dusk documentation `chromedriver-linux` 2. run ./chromedriver-linuxIt's
YOUR_PROJECT/vendor/laravel/dusk/bin/, but yeah, your solution does work for me. Still, I am not sure why is it so, and why won't it work without it as it did and as it should?
@Maidomax some how in linux its not able to start dusk service it self so we need to start dusk service for linux manually.
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
- go to the YOUR_PROJECT/laravel/dusk/bin/ and check file permission needs to be 755 as per laravel dusk documentation
chromedriver-linux- run
./chromedriver-linux- 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"]}
Wow, same problem here but when i follow this one, it works fine, thanks @ankitvadariya, anyways why it is not running automatically in ubuntu machine?
This is happening to us on latest chromedriver + chrome, make all tests super unstable.
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.:

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!
Same error.
But @axettone solution works for me.
How to instal google-chrome-stable on ubuntu server: https://askubuntu.com/questions/510056/how-to-install-google-chrome
I got a similar error
Caused by
Facebook\WebDriverException\UnknownErrorException: unknown error: session deleted because of page crash
from unknown error: cannot determine loading status
from tab crashed
(Session info: headless chrome=92.0.4515.107)
and
Facebook\WebDriverException\WebDriverCurlException: Curl error thrown for http POST to /session with params: {"capabilities":{"firstMatch":[{"browserName":"chrome","goog:chromeOptions":{"mobileEmulation":{"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36"},"args":["--window-size=1920,1080","--disable-gpu","--headless","--no-sandbox"]}}]},"desiredCapabilities":{"browserName":"chrome","platform":"ANY","chromeOptions":{"mobileEmulation":{"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36"},"args":["--window-size=1920,1080","--disable-gpu","--headless","--no-sandbox"]}}}
Operation timed out after 30002 milliseconds with 0 bytes received
I tried multiple things... downgraded chrome... what seems to have finally solved is increase the amount of memory on the server from 1 gb -> 2 gb
EDIT still have this issue, somehow, with certain sites. Not always
Most helpful comment
Have still the issue...
I even updated ChromeDriver to: