-
Notifications
You must be signed in to change notification settings - Fork 328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
session not created: probably user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir #1155
Comments
Hey there, thanks for reporting this issue. We'll need more info and/or code to debug this further. Can you please create a repository with the command below, commit the code that reproduces the issue as one separate commit on the main/master branch and share the repository here? Please make sure that you have the latest version of the Laravel installer in order to run this command. Please also make sure you have both Git & the GitHub CLI tool properly set up.
Do not amend and create a separate commit with your custom changes. After you've posted the repository, we'll try to reproduce the issue. Thanks! |
No matter how uniquely I regenerate --user-data-dir, I keep encountering an error saying "already in use" when making a POST request to http://localhost:9515/session. chromedriver version : ChromeDriver 132.0.6834.84 (c1a6c2d428b5b484febdecda9475aba38de5a502-refs/branch-heads/6834@{#3391}) When I run dusk:chrome-driver --detect, it installs version 83, and even after updating to the latest version, the issue persists. but The same source works fine when run on another Mac machine. chrom ![]() |
Can you try using Chrome for Testing: https://developer.chrome.com/blog/chrome-for-testing It would be impossible to solve this without a reliable way to replicate the issue. |
I'm facing the same issue. Have you figured it out yet? |
Ok i solved it by adding 'no-sandbox' to the driver options: # DuskTestCase.php
/**
* Create the RemoteWebDriver instance.
*/
protected function driver(): RemoteWebDriver
{
$options = (new ChromeOptions)->addArguments(collect([
$this->shouldStartMaximized() ? '--start-maximized' : '--window-size=1920,1080',
'--disable-search-engine-choice-screen',
])->unless($this->hasHeadlessDisabled(), function (Collection $items) {
return $items->merge([
'--disable-gpu',
'--headless=new',
'--no-sandbox',
]);
})->all());
return RemoteWebDriver::create(
$_ENV['DUSK_DRIVER_URL'] ?? env('DUSK_DRIVER_URL') ?? 'http://127.0.0.1:9515',
DesiredCapabilities::chrome()->setCapability(
ChromeOptions::CAPABILITY, $options
)
);
} |
The permission issue arose due to installing the Dracula theme for oh-my-zsh. |
@asterism612 What permission issues did you have? I'm facing the same issue trying to run dusk inside a Docker container using Laravel 11. I've tried
but still having the same problem. |
@asterism612 an update on this would be very helpful. |
We're also having that issue :( Anyone got a chance to fix / workaround it? Thanks alot Edit : my colleague managed to get it working by using official chrome version instead of snap version (he uninstalled chromium from snap). |
I've come back to this after a couple of weeks and managed to resolve the problem. The issue is in the docker container, I'd installed Chrome as the root user (and given everyone else permissions to use it). When I was using it as user 1000, as they didn't have a home directory, it failed. I then updated to run the Dockerfile as the root user, and everything sprung to life. For reference (if you're using Jenkins like I am):
|
Wanted to say we're having this issue across all developers across all projects using Dusk since maybe a month ago. We're not using Docker/etc. just Valet and a normal install of Chrome. I've already spent half a day poking around and found absolutely nothing to go on - as above, specifying your own user directory doesn't seem to make any difference. If there's anything you would need from us to find the root cause just say the word. |
As someone who using Laravel Dusk daily I don't have any way to reproduce the issue. Appreciate any help to debug and/or fix the issue. |
Dusk Version
10.48.25
Laravel Version
10.4
PHP Version
8.3.14
PHPUnit Version
10.0.1
Database Driver & Version
Mysql 8.0
Description
Error message : session not created: probably user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir
protected function driver(): RemoteWebDriver
{
$options = (new ChromeOptions)->addArguments(collect([
$this->shouldStartMaximized() ? '--start-maximized' : '--window-size=1920,1080',
])->unless($this->hasHeadlessDisabled(), function (Collection $items) {
return $items->merge([
'--disable-gpu',
'--headless=new',
'--no-sandbox'
]);
})->all());
}
Steps To Reproduce
The text was updated successfully, but these errors were encountered: