Path: blob/trunk/rb/lib/selenium/webdriver/safari/options.rb
1865 views
# frozen_string_literal: true12# Licensed to the Software Freedom Conservancy (SFC) under one3# or more contributor license agreements. See the NOTICE file4# distributed with this work for additional information5# regarding copyright ownership. The SFC licenses this file6# to you under the Apache License, Version 2.0 (the7# "License"); you may not use this file except in compliance8# with the License. You may obtain a copy of the License at9#10# http://www.apache.org/licenses/LICENSE-2.011#12# Unless required by applicable law or agreed to in writing,13# software distributed under the License is distributed on an14# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY15# KIND, either express or implied. See the License for the16# specific language governing permissions and limitations17# under the License.1819module Selenium20module WebDriver21module Safari22class Options < WebDriver::Options23attr_accessor :options2425# @see https://developer.apple.com/documentation/webkit/about_webdriver_for_safari26CAPABILITIES = {automatic_inspection: 'safari:automaticInspection',27automatic_profiling: 'safari:automaticProfiling'}.freeze28BROWSER = Selenium::WebDriver::Safari.technology_preview? ? 'Safari Technology Preview' : 'safari'2930def add_option(name, value = nil)31key = name.is_a?(Hash) ? name.keys.first : name32raise ArgumentError, 'Safari does not support options that are not namespaced' unless key.to_s.include?(':')3334super35end3637def as_json(*)38@options[:browser_name] = Safari.technology_preview? ? 'Safari Technology Preview' : 'safari'39super40end41end # Options42end # Safari43end # WebDriver44end # Selenium454647