Skip to content

Unrecognized chrome option: 'user-data-dir' in Selenium Grid 4.17.0 node TOML configuration[🐛 Bug]:  #13598

@csk2121

Description

@csk2121

What happened?

I am trying to implement and use Chrome browser profile using 'user-data-dir', but I am not successful.

Option 1: Using node TOML file configuration

  • Session is not created. Node TOML file and the Exception details are shown below [Option1 Exception]

Option 2: Using chromeOptions in the test script at the time of creating the Chrome WebDriver

  • Session is created for the first test and the browser profile is also created.
  • Second test or remaining parallel tests onwards the session is not created. Exception details are shown below [Option2 Exception]

options.addArguments("--user-data-dir=" + chromeProfilePath);
options.addArguments("--profile-directory=auto-test");

I am looking at option1 primarily and want to check if 'user-data-dir' is supported in the grid configuration TOML file. Option2 is OK if Option1 is not feasible.

I would like to post here for help.Thanks in advance

Option1 Exception:

WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "c49e76b96cd5867537eb2d3d0fe7063e","eventTime": 1708227502102800498,"eventName": "exception","attributes": {"driver.url": "http:\u002f\u002flocalhost:23925","exception.message": "Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 400. Message: invalid argument: entry 0 of 'firstMatch' is invalid\nfrom invalid argument: cannot parse capability: goog:chromeOptions\nfrom invalid argument: unrecognized chrome option: user-data-dir \nHost info: host: 'xxxxxxx', ip: 'XXXXX'\nBuild info: version: '4.12.1', revision: '8e34639b11'\nSystem info: os.name: 'Windows Server 2016', os.arch: 'amd64', os.version: '10.0', java.version: '11.8.0_332'\nDriver info: driver.version: unknown","exception.stacktrace": "org.openqa.selenium.SessionNotCreatedException: Could not start a new session.

Option2 Exception:

WARN [DriverServiceSessionFactory.apply] - Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: unknown error: failed to write prefs file
Host info: host: 'xxxxxx', ip: 'xxxxxx'
Build info: version: '4.17.0', revision: 'e52b1be057*'
System info: os.name: 'Windows Server 2016', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.20'
Driver info: driver.version: unknown
19:23:45.262 WARN [SeleniumSpanExporter$1.lambda$export$1] - org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: failed to write prefs file
Host info: host: 'xxxxxx', ip: 'xxxxxx'
Build info: version: '4.17.0', revision: 'e52b1be057*'
System info: os.name: 'Windows Server 2016', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.20'
Driver info: driver.version: unknown
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:139)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:95)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:67)
at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply(DriverServiceSessionFactory.java:162)
at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply(DriverServiceSessionFactory.java:72)
at org.openqa.selenium.grid.node.local.SessionSlot.apply(SessionSlot.java:147)
at org.openqa.selenium.grid.node.local.LocalNode.newSession(LocalNode.java:464)
at org.openqa.selenium.grid.node.NewNodeSession.execute(NewNodeSession.java:50)
at org.openqa.selenium.remote.http.Route$TemplatizedRoute.handle(Route.java:192)
at org.openqa.selenium.remote.http.Route.execute(Route.java:69)
at org.openqa.selenium.grid.security.RequiresSecretFilter.lambda$apply$0(RequiresSecretFilter.java:62)
at org.openqa.selenium.remote.tracing.SpanWrappedHttpHandler.execute(SpanWrappedHttpHandler.java:87)
at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)
at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:346)
at org.openqa.selenium.remote.http.Route.execute(Route.java:69)
at org.openqa.selenium.grid.node.Node.execute(Node.java:262)
at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:346)
at org.openqa.selenium.remote.http.Route.execute(Route.java:69)
at org.openqa.selenium.remote.AddWebDriverSpecHeaders.lambda$apply$0(AddWebDriverSpecHeaders.java:35)
at org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)
at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)
at org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)
at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)
at org.openqa.selenium.netty.server.SeleniumHandler.lambda$channelRead0$0(SeleniumHandler.java:44)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)

WARN [SeleniumSpanExporter$1.lambda$export$1] - Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: unknown error: failed to write prefs file
Host info: host: 'xxxxxxxx', ip: 'xxxxxx'
Build info: version: '4.17.0', revision: 'e52b1be057*'
System info: os.name: 'Windows Server 2016', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.20'
Driver info: driver.version: unknown
19:23:45.264 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "6ce4a0182096449051ea728dd9c7fab7","eventTime": 1708305824742044905,"eventName": "exception","attributes": {"driver.url": "http:\u002f\u002flocalhost:29600","exception.message": "Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: unknown error: failed to write prefs file \nHost info: host: 'xxxxxxx', ip: 'xxxxxx'\nBuild info: version: '4.17.0', revision: 'e52b1be057*'\nSystem info: os.name: 'Windows Server 2016', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.20'\nDriver info: driver.version: unknown","exception.stacktrace": "org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: failed to write prefs file \nHost info: host: 'xxxxxx', ip: 'xxxxxx'\nBuild info: version: '4.17.0', revision: 'e52b1be057*'\nSystem info: os.name: 'Windows Server 2016', os.arch: 'amd64', os.version: '10.0',

Node TOML file :: Option1

[events]
publish-events = "tcp://localhost:4442"
subscribe-events = "tcp://localhost:4443"

[node]
detect-drivers = false
override-max-sessions = true
max-sessions = 50
max-threads = 50
session-timeout = 1800

[[node.driver-configuration]]
max-sessions = 50
display-name = "Chrome"
stereotype = '{"browserName": "chrome", "browserVersion": "121", "platformName": "WINDOWS", "goog:chromeOptions": {"binary": "chrome-win64/chrome.exe", "user-data-dir": "browser-profiles/chrome/auto-test"}}'
webdriver-executable = 'chromedriver-win64/chromedriver.exe'

[events]
publish-events = "tcp://localhost:4442"
subscribe-events = "tcp://localhost:4443"

Node TOML file :: Option2

How can we reproduce the issue?

1. When we add the below chromeOptions args and run the tests in parallel the issue is seen. The first test pass and remaining tests running in parallel fail.
2. Unable to configure the user-data-dir in node TOML configuration file

options.addArguments("--user-data-dir=" + chromeProfilePath);
options.addArguments("--profile-directory=auto-test");

Relevant log output

WARN [DriverServiceSessionFactory.apply] - Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: unknown error: failed to write prefs file
Host info: host: 'xxxxxx', ip: 'xxxxxx'
Build info: version: '4.17.0', revision: 'e52b1be057*'
System info: os.name: 'Windows Server 2016', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.20'
Driver info: driver.version: unknown
19:23:45.262 WARN [SeleniumSpanExporter$1.lambda$export$1] - org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: failed to write prefs file
Host info: host: 'xxxxxx', ip: 'xxxxxx'
Build info: version: '4.17.0', revision: 'e52b1be057*'
System info: os.name: 'Windows Server 2016', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.20'
Driver info: driver.version: unknown
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:139)
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:95)
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:67)
        at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply(DriverServiceSessionFactory.java:162)
        at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply(DriverServiceSessionFactory.java:72)
        at org.openqa.selenium.grid.node.local.SessionSlot.apply(SessionSlot.java:147)
        at org.openqa.selenium.grid.node.local.LocalNode.newSession(LocalNode.java:464)
        at org.openqa.selenium.grid.node.NewNodeSession.execute(NewNodeSession.java:50)
        at org.openqa.selenium.remote.http.Route$TemplatizedRoute.handle(Route.java:192)
        at org.openqa.selenium.remote.http.Route.execute(Route.java:69)
        at org.openqa.selenium.grid.security.RequiresSecretFilter.lambda$apply$0(RequiresSecretFilter.java:62)
        at org.openqa.selenium.remote.tracing.SpanWrappedHttpHandler.execute(SpanWrappedHttpHandler.java:87)
        at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)
        at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:346)
        at org.openqa.selenium.remote.http.Route.execute(Route.java:69)
        at org.openqa.selenium.grid.node.Node.execute(Node.java:262)
        at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:346)
        at org.openqa.selenium.remote.http.Route.execute(Route.java:69)
        at org.openqa.selenium.remote.AddWebDriverSpecHeaders.lambda$apply$0(AddWebDriverSpecHeaders.java:35)
        at org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)
        at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)
        at org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)
        at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)
        at org.openqa.selenium.netty.server.SeleniumHandler.lambda$channelRead0$0(SeleniumHandler.java:44)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)

WARN [SeleniumSpanExporter$1.lambda$export$1] - Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: unknown error: failed to write prefs file
Host info: host: 'xxxxxxxx', ip: 'xxxxxx'
Build info: version: '4.17.0', revision: 'e52b1be057*'
System info: os.name: 'Windows Server 2016', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.20'
Driver info: driver.version: unknown
19:23:45.264 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "6ce4a0182096449051ea728dd9c7fab7","eventTime": 1708305824742044905,"eventName": "exception","attributes": {"driver.url": "http:\u002f\u002flocalhost:29600","exception.message": "Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: unknown error: failed to write prefs file \nHost info: host: 'xxxxxxx', ip: 'xxxxxx'\nBuild info: version: '4.17.0', revision: 'e52b1be057*'\nSystem info: os.name: 'Windows Server 2016', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.20'\nDriver info: driver.version: unknown","exception.stacktrace": "org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: failed to write prefs file \nHost info: host: 'xxxxxx', ip: 'xxxxxx'\nBuild info: version: '4.17.0', revision: 'e52b1be057*'\nSystem info: os.name: 'Windows Server 2016', os.arch: 'amd64', os.version: '10.0',

Operating System

Windows Server 2016

Selenium version

Selenium 4.15

What are the browser(s) and version(s) where you see this issue?

Chrome 121.0.6167.184

What are the browser driver(s) and version(s) where you see this issue?

ChromeDriver 121.0.6167.184

Are you using Selenium Grid?

4.17.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-questionApplied to questions. Issues should be closed and send the user to community resources.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions