Skip to content

ChromeDriver doesn't work in headless mode on Linux #414

@annaerdi

Description

@annaerdi

Hi!

When I run ghosts in "isheadless": "false" mode, everything works fine. But when I use "isheadless": "true", I get a session not created: DevToolsActivePort file doesn't exist error.

I'm using Ubuntu 22.04. I have installed the latest Chrome and its corresponding ChromeDriver. They are both in the ghosts folder.

This is my timeline.json file:

{
  "Id": "c3416428-99df-43b6-8370-046760da961f",
  "Status": "Run",
  "TimeLineHandlers": [
    {
      "HandlerType": "BrowserChrome",
      "Initial": "about:blank",
      "UtcTimeOn": "00:00:00",
      "UtcTimeOff": "00:00:00",
      "HandlerArgs": {
        "executable-location": "~/ghosts-experiment/ghosts-client-linux-v8.0.0/chrome-linux64",
        "isheadless": "true",
        "blockimages": "false",
        "blockstyles": "false",
        "blockflash": "false",
        "blockscripts": "true",
        "stickiness": 0,
        "stickiness-depth-min": 5,
        "stickiness-depth-max": 10000,
        "incognito": "false",
        "command-line-args": [
          "--ignore-certificate-errors"
        ]
      },
      "Loop": true,
      "TimeLineEvents": [
        {
          "Command": "random",
          "CommandArgs": [
            "http://www.ceoexpress.com",
            "http://wikipedia.org",
            "http://reddit.com",
            "http://instagram.com",
            "http://imdb.com",
            "http://huffingtonpost.com",
            "http://nytimes.com",
            "http://msn.com"
          ],
          "DelayAfter": 15000,
          "DelayBefore": 0
        }
      ],
      "ScheduleType": "Other"
    }
  ]
}

This is the app.log file:

2024/09/23 22:16:46.855|ghosts.client.linux.Program.Run|Initiating ghosts.client.linux startup - Local: 00:16:46.8326007 UTC: 22:16:46.8536619
2024/09/23 22:16:47.061|Ghosts.Domain.Code.ClientConfigurationLoader.get_Config|App config loaded successfully: /home/anna/ghosts-experiment/ghosts-client-linux-v8.0.0/config/application.json
2024/09/23 22:16:47.061|ghosts.client.linux.Program.Run|Sockets enabled. Connecting...
2024/09/23 22:16:47.061|ghosts.client.linux.Comms.CheckId..ctor|CheckId instantiated with ID: 172cb37f-43ef-4a4f-ae77-ad0d1b2dc68e
2024/09/23 22:16:47.061|ghosts.client.linux.Program.Run|CheckID: 172cb37f-43ef-4a4f-ae77-ad0d1b2dc68e
2024/09/23 22:16:47.075|ghosts.client.linux.Program.Run|Survey disabled, continuing.
2024/09/23 22:16:47.075|ghosts.client.linux.Program.Run|Handlers enabled, initalizing...
2024/09/23 22:16:47.143|ghosts.client.linux.timelineManager.Orchestrator.Run|Stopfile watcher is starting
2024/09/23 22:16:47.151|ghosts.client.linux.timelineManager.Orchestrator.ThreadLaunch|Attempting new thread for: BrowserChrome
2024/09/23 22:16:47.229|ghosts.client.linux.Comms.Updates.GetServerUpdates|09/24/2024 00:16:47 - No new configuration found
2024/09/23 22:16:47.691|ghosts.client.linux.handlers.BrowserChrome..ctor|System.InvalidOperationException: session not created: Chrome failed to start: exited normally.
  (session not created: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /home/anna/.cache/selenium/chrome/linux64/129.0.6668.58/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.) (SessionNotCreated)

After some googling, I tried adding these option, but they don't solve the issue either:

"command-line-args": [
  "--no-sandbox",
  "--disable-dev-shm-usage"
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions