Skip to content

[🐛 Bug]: [rust] Selenium Manager does not return browser path without driver #16215

@thc202

Description

@thc202

Description

SM does not provide the browser path (even if it knows it) when the driver is not available.

Run ./selenium-manager --offline --debug --browser firefox --cache-path ./cache --output json
(cache does not have any drivers)

{
  "logs": [
    {
      "level": "DEBUG",
      "timestamp": 0,
      "message": "Offline flag set, but also asked not to avoid browser downloads. Honouring offline flag"
    },
    {
      "level": "DEBUG",
      "timestamp": 0,
      "message": "Using Selenium Manager in offline mode"
    },
    {
      "level": "DEBUG",
      "timestamp": 0,
      "message": "geckodriver not found in PATH"
    },
    {
      "level": "DEBUG",
      "timestamp": 0,
      "message": "firefox detected at /Applications/Firefox.app/Contents/MacOS/firefox"
    },
    {
      "level": "DEBUG",
      "timestamp": 0,
      "message": "Running command: /Applications/Firefox.app/Contents/MacOS/firefox -v"
    },
    {
      "level": "DEBUG",
      "timestamp": 0,
      "message": "Output: \"Mozilla Firefox 141.0.3\""
    },
    {
      "level": "DEBUG",
      "timestamp": 0,
      "message": "Detected browser: firefox 141.0.3"
    },
    {
      "level": "WARN",
      "timestamp": 0,
      "message": "Unable to discover proper geckodriver version in offline mode"
    }
  ],
  "result": {
    "code": 0,
    "message": "",
    "driver_path": "",
    "browser_path": ""
  }
}

Also worth noting that it returns code 0 even if it "failed" to provide any information.

Run ./selenium-manager --offline --debug --browser firefox --cache-path ./cache-2 --output json
(cache-2 has geckodriver)

{
  "logs": [
    {
      "level": "DEBUG",
      "timestamp": 0,
      "message": "Offline flag set, but also asked not to avoid browser downloads. Honouring offline flag"
    },
    {
      "level": "DEBUG",
      "timestamp": 0,
      "message": "Using Selenium Manager in offline mode"
    },
    {
      "level": "DEBUG",
      "timestamp": 0,
      "message": "geckodriver not found in PATH"
    },
    {
      "level": "DEBUG",
      "timestamp": 0,
      "message": "firefox detected at /Applications/Firefox.app/Contents/MacOS/firefox"
    },
    {
      "level": "DEBUG",
      "timestamp": 0,
      "message": "Running command: /Applications/Firefox.app/Contents/MacOS/firefox -v"
    },
    {
      "level": "DEBUG",
      "timestamp": 0,
      "message": "Output: \"Mozilla Firefox 141.0.3\""
    },
    {
      "level": "DEBUG",
      "timestamp": 0,
      "message": "Detected browser: firefox 141.0.3"
    },
    {
      "level": "DEBUG",
      "timestamp": 0,
      "message": "Required driver: geckodriver 0.36.0"
    },
    {
      "level": "DEBUG",
      "timestamp": 0,
      "message": "geckodriver 0.36.0 already in the cache"
    },
    {
      "level": "INFO",
      "timestamp": 0,
      "message": "Driver path: ./cache-2/geckodriver/mac64/0.36.0/geckodriver"
    },
    {
      "level": "INFO",
      "timestamp": 0,
      "message": "Browser path: /Applications/Firefox.app/Contents/MacOS/firefox"
    }
  ],
  "result": {
    "code": 0,
    "message": "",
    "driver_path": "./cache-2/geckodriver/mac64/0.36.0/geckodriver",
    "browser_path": "/Applications/Firefox.app/Contents/MacOS/firefox"
  }
}

Is there any technical reason why the browser path is not provided in both cases? We are using SM now because the FirefoxBinary class was removed which was being used for that. (We need to get the browser path to do some setup with Firefox, we also have our own drivers.)

Reproducible Code

Using SM not any code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    B-managerSelenium ManagerC-rustRust code is mostly Selenium ManagerI-defectSomething is not working as intended

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions