# frozen_string_literal: true # Licensed to the Software Freedom Conservancy (SFC) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The SFC licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # 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. # This file is automatically generated. Any changes will be lost! module Selenium module DevTools module V103 class Emulation EVENTS = { virtual_time_budget_expired: 'virtualTimeBudgetExpired', }.freeze def initialize(devtools) @devtools = devtools end def on(event, &block) event = EVENTS[event] if event.is_a?(Symbol) @devtools.callbacks["Emulation.#{event}"] << block end def can_emulate @devtools.send_cmd('Emulation.canEmulate') end def clear_device_metrics_override @devtools.send_cmd('Emulation.clearDeviceMetricsOverride') end def clear_geolocation_override @devtools.send_cmd('Emulation.clearGeolocationOverride') end def reset_page_scale_factor @devtools.send_cmd('Emulation.resetPageScaleFactor') end def set_focus_emulation_enabled(enabled:) @devtools.send_cmd('Emulation.setFocusEmulationEnabled', enabled: enabled) end def set_auto_dark_mode_override(enabled: nil) @devtools.send_cmd('Emulation.setAutoDarkModeOverride', enabled: enabled) end def set_cpu_throttling_rate(rate:) @devtools.send_cmd('Emulation.setCPUThrottlingRate', rate: rate) end def set_default_background_color_override(color: nil) @devtools.send_cmd('Emulation.setDefaultBackgroundColorOverride', color: color) end def set_device_metrics_override(width:, height:, device_scale_factor:, mobile:, scale: nil, screen_width: nil, screen_height: nil, position_x: nil, position_y: nil, dont_set_visible_size: nil, screen_orientation: nil, viewport: nil, display_feature: nil) @devtools.send_cmd('Emulation.setDeviceMetricsOverride', width: width, height: height, deviceScaleFactor: device_scale_factor, mobile: mobile, scale: scale, screenWidth: screen_width, screenHeight: screen_height, positionX: position_x, positionY: position_y, dontSetVisibleSize: dont_set_visible_size, screenOrientation: screen_orientation, viewport: viewport, displayFeature: display_feature) end def set_scrollbars_hidden(hidden:) @devtools.send_cmd('Emulation.setScrollbarsHidden', hidden: hidden) end def set_document_cookie_disabled(disabled:) @devtools.send_cmd('Emulation.setDocumentCookieDisabled', disabled: disabled) end def set_emit_touch_events_for_mouse(enabled:, configuration: nil) @devtools.send_cmd('Emulation.setEmitTouchEventsForMouse', enabled: enabled, configuration: configuration) end def set_emulated_media(media: nil, features: nil) @devtools.send_cmd('Emulation.setEmulatedMedia', media: media, features: features) end def set_emulated_vision_deficiency(type:) @devtools.send_cmd('Emulation.setEmulatedVisionDeficiency', type: type) end def set_geolocation_override(latitude: nil, longitude: nil, accuracy: nil) @devtools.send_cmd('Emulation.setGeolocationOverride', latitude: latitude, longitude: longitude, accuracy: accuracy) end def set_idle_override(is_user_active:, is_screen_unlocked:) @devtools.send_cmd('Emulation.setIdleOverride', isUserActive: is_user_active, isScreenUnlocked: is_screen_unlocked) end def clear_idle_override @devtools.send_cmd('Emulation.clearIdleOverride') end def set_navigator_overrides(platform:) @devtools.send_cmd('Emulation.setNavigatorOverrides', platform: platform) end def set_page_scale_factor(page_scale_factor:) @devtools.send_cmd('Emulation.setPageScaleFactor', pageScaleFactor: page_scale_factor) end def set_script_execution_disabled(value:) @devtools.send_cmd('Emulation.setScriptExecutionDisabled', value: value) end def set_touch_emulation_enabled(enabled:, max_touch_points: nil) @devtools.send_cmd('Emulation.setTouchEmulationEnabled', enabled: enabled, maxTouchPoints: max_touch_points) end def set_virtual_time_policy(policy:, budget: nil, max_virtual_time_task_starvation_count: nil, initial_virtual_time: nil) @devtools.send_cmd('Emulation.setVirtualTimePolicy', policy: policy, budget: budget, maxVirtualTimeTaskStarvationCount: max_virtual_time_task_starvation_count, initialVirtualTime: initial_virtual_time) end def set_locale_override(locale: nil) @devtools.send_cmd('Emulation.setLocaleOverride', locale: locale) end def set_timezone_override(timezone_id:) @devtools.send_cmd('Emulation.setTimezoneOverride', timezoneId: timezone_id) end def set_visible_size(width:, height:) @devtools.send_cmd('Emulation.setVisibleSize', width: width, height: height) end def set_disabled_image_types(image_types:) @devtools.send_cmd('Emulation.setDisabledImageTypes', imageTypes: image_types) end def set_user_agent_override(user_agent:, accept_language: nil, platform: nil, user_agent_metadata: nil) @devtools.send_cmd('Emulation.setUserAgentOverride', userAgent: user_agent, acceptLanguage: accept_language, platform: platform, userAgentMetadata: user_agent_metadata) end def set_automation_override(enabled:) @devtools.send_cmd('Emulation.setAutomationOverride', enabled: enabled) end end # Emulation end # V103 end # DevTools end # Selenium