Skip to content
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

Open
asterism612 opened this issue Jan 17, 2025 · 3 comments

Comments

@asterism612
Copy link

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());

$server = RemoteWebDriver::create(
  $_ENV['DUSK_DRIVER_URL'] ?? 'http://localhost:9515',
  DesiredCapabilities::chrome()->setCapability(
    ChromeOptions::CAPABILITY,
    $options
  )
);

dd($server);

return $server;

}

Steps To Reproduce

  1. php artisan dusk
  2. 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
@crynobone
Copy link
Member

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.

laravel new bug-report --github="--public"

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!

@asterism612
Copy link
Author

asterism612 commented Jan 19, 2025

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})
chrome version : Google Chrome 132.0.6834.84

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

Image

@crynobone
Copy link
Member

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.

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

No branches or pull requests

2 participants