SeleniumHQ/selenium · error · Error::WebDriverError

Safari Service does not support setting log output

Error message

Safari Service does not support setting log output

What it means

Safari::Service#initialize rejects the log: keyword because safaridriver has no command-line flag for redirecting its log output to a file, unlike chromedriver/geckodriver. The binding refuses the argument up front (if log is truthy) rather than silently ignoring it, so a developer learns immediately that log capture is unsupported for Safari.

Source

Thrown at rb/lib/selenium/webdriver/safari/service.rb:29

#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

module Selenium
  module WebDriver
    module Safari
      class Service < WebDriver::Service
        DEFAULT_PORT = 7050
        EXECUTABLE = 'safaridriver'
        SHUTDOWN_SUPPORTED = false
        DRIVER_PATH_ENV_KEY = 'SE_SAFARIDRIVER'
        def initialize(path: nil, port: nil, log: nil, args: nil)
          raise Error::WebDriverError, 'Safari Service does not support setting log output' if log

          super
        end

        def log=(*)
          raise Error::WebDriverError, 'Safari Service does not support setting log output'
        end
      end # Service
    end # Safari
  end # WebDriver
end # Selenium

View on GitHub (pinned to aa36b38e69)

Solutions

  1. Remove the log: argument from the Safari::Service initializer.
  2. Branch Service construction per browser so Safari never receives log:.
  3. For Safari diagnostics use `safaridriver` directly from a terminal or macOS Console instead of the Service log option.

Example fix

# before
service = Selenium::WebDriver::Safari::Service.new(log: 'safari.log')

# after
service = Selenium::WebDriver::Safari::Service.new
Defensive patterns

Strategy: validation

Validate before calling

# Build Safari service without log:
service = Selenium::WebDriver::Safari::Service.new
# Only add log for drivers that support it:
service = Selenium::WebDriver::Chrome::Service.new(log: 'chrome.log') unless browser == :safari

Type guard

def supports_service_log?(browser)
  browser != :safari
end

Try / catch

begin
  service = Selenium::WebDriver::Safari::Service.new(log: path)
rescue Selenium::WebDriver::Error::WebDriverError => e
  raise unless e.message.include?('does not support setting log output')
  service = Selenium::WebDriver::Safari::Service.new
end

Prevention

When it happens

Trigger: Calling Selenium::WebDriver::Safari::Service.new(log: '/tmp/safari.log') or Selenium::WebDriver::Safari::Service.new(log: $stdout), or passing a Service configured with a log: value into a Safari Driver. Any truthy value for the log keyword in the constructor triggers it.

Common situations: Sharing a Service-configuration block across browsers that sets log: for all of them; migrating a Chrome test suite to Safari and keeping the log file argument; trying to capture safaridriver diagnostics the same way as other drivers.

Related errors


AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14). Data as JSON: /api/errors/fd0b807733a1b6d8. Report an issue: GitHub.