Path: blob/trunk/rb/lib/selenium/webdriver/chromium/features.rb
1856 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 Chromium22module Features23CHROMIUM_COMMANDS = {24launch_app: [:post, 'session/:session_id/chromium/launch_app'],25get_network_conditions: [:get, 'session/:session_id/chromium/network_conditions'],26set_network_conditions: [:post, 'session/:session_id/chromium/network_conditions'],27delete_network_conditions: [:delete, 'session/:session_id/chromium/network_conditions'],28set_permission: [:post, 'session/:session_id/permissions'],29get_available_log_types: [:get, 'session/:session_id/se/log/types'],30get_log: [:post, 'session/:session_id/se/log']31}.freeze3233def launch_app(id)34execute :launch_app, {}, {id: id}35end3637def cast_sinks38execute :get_cast_sinks39end4041def cast_sink_to_use=(name)42execute :set_cast_sink_to_use, {}, {sinkName: name}43end4445def cast_issue_message46execute :cast_issue_message47end4849def start_cast_tab_mirroring(name)50execute :start_cast_tab_mirroring, {}, {sinkName: name}51end5253def start_cast_desktop_mirroring(name)54execute :start_cast_desktop_mirroring, {}, {sinkName: name}55end5657def stop_casting(name)58execute :stop_casting, {}, {sinkName: name}59end6061def set_permission(name, value)62execute :set_permission, {}, {descriptor: {name: name}, state: value}63end6465def network_conditions66execute :get_network_conditions67end6869def network_conditions=(conditions)70execute :set_network_conditions, {}, {network_conditions: conditions}71end7273def delete_network_conditions74execute :delete_network_conditions75end7677def send_command(command_params)78execute :send_command, {}, command_params79end8081def available_log_types82types = execute :get_available_log_types83Array(types).map(&:to_sym)84end8586def log(type)87data = execute :get_log, {}, {type: type.to_s}8889Array(data).map do |l|90LogEntry.new l.fetch('level', 'UNKNOWN'), l.fetch('timestamp'), l.fetch('message')91rescue KeyError92next93end94end95end # Bridge96end # Chromium97end # WebDriver98end # Selenium99100101