Skip to content

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 #1126

@Wremeker

Description

@Wremeker

Bug description

I coudn't create session in headless mode in ubuntu while on Mac OS everything is fine. I added parameter folder
--user-data-dir, it creates folder in tmp/, but the same issue keep showing.

Error message: 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 ;

Any ideas how to debug and solve?

How could the issue be reproduced

Run chromedriver with these capabilities on ubuntu 20.04


private static function getChromeCapabilities(): DesiredCapabilities
    {
        $desiredCapabilities = DesiredCapabilities::chrome();
        $chromeOptions = new ChromeOptions();
        $tempDir = sys_get_temp_dir() . '/chrome-profile-' . uniqid();
        mkdir($tempDir, 0700, true);

        $arguments = [
            '--user-data-dir=' . $tempDir,
            '--no-sandbox',
            '--disable-gpu',
            '--disable-dev-shm-usage',
            '--disable-extensions',
            '--disable-infobars',
            '--disable-popup-blocking',
        ];

        if (config('app.headless_driver')) {
            $arguments[] = '--headless';
        }

        $chromeOptions->addArguments($arguments);
        $desiredCapabilities->setCapability(ChromeOptions::CAPABILITY, $chromeOptions);

        return $desiredCapabilities;
    }

Expected behavior

No response

Php-webdriver version

1.15.2

PHP version

7.4

How do you start the browser driver or Selenium server

binary in system

Selenium server / Selenium Docker image version

Browser driver (chromedriver/geckodriver...) version

135.0.7049.114

Browser name and version

Google chrome 135.0.7049.114

Operating system

Ubuntu 20.04

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions