Class: Selenium::DevTools::V129::Emulation
- Inherits:
-
Object
- Object
- Selenium::DevTools::V129::Emulation
- Defined in:
- lib/selenium/devtools/v129/emulation.rb
Constant Summary collapse
- EVENTS =
{ virtual_time_budget_expired: 'virtualTimeBudgetExpired', }.freeze
Instance Method Summary collapse
- #can_emulate ⇒ Object
- #clear_device_metrics_override ⇒ Object
- #clear_device_posture_override ⇒ Object
- #clear_geolocation_override ⇒ Object
- #clear_idle_override ⇒ Object
- #get_overridden_sensor_information(type:) ⇒ Object
-
#initialize(devtools) ⇒ Emulation
constructor
A new instance of Emulation.
- #on(event, &block) ⇒ Object
- #reset_page_scale_factor ⇒ Object
- #set_auto_dark_mode_override(enabled: nil) ⇒ Object
- #set_automation_override(enabled:) ⇒ Object
- #set_cpu_throttling_rate(rate:) ⇒ Object
- #set_default_background_color_override(color: nil) ⇒ Object
- #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, device_posture: nil) ⇒ Object
- #set_device_posture_override(posture:) ⇒ Object
- #set_disabled_image_types(image_types:) ⇒ Object
- #set_document_cookie_disabled(disabled:) ⇒ Object
- #set_emit_touch_events_for_mouse(enabled:, configuration: nil) ⇒ Object
- #set_emulated_media(media: nil, features: nil) ⇒ Object
- #set_emulated_vision_deficiency(type:) ⇒ Object
- #set_focus_emulation_enabled(enabled:) ⇒ Object
- #set_geolocation_override(latitude: nil, longitude: nil, accuracy: nil) ⇒ Object
- #set_hardware_concurrency_override(hardware_concurrency:) ⇒ Object
- #set_idle_override(is_user_active:, is_screen_unlocked:) ⇒ Object
- #set_locale_override(locale: nil) ⇒ Object
- #set_navigator_overrides(platform:) ⇒ Object
- #set_page_scale_factor(page_scale_factor:) ⇒ Object
- #set_pressure_source_override_enabled(enabled:, source:, metadata: nil) ⇒ Object
- #set_pressure_state_override(source:, state:) ⇒ Object
- #set_script_execution_disabled(value:) ⇒ Object
- #set_scrollbars_hidden(hidden:) ⇒ Object
- #set_sensor_override_enabled(enabled:, type:, metadata: nil) ⇒ Object
- #set_sensor_override_readings(type:, reading:) ⇒ Object
- #set_timezone_override(timezone_id:) ⇒ Object
- #set_touch_emulation_enabled(enabled:, max_touch_points: nil) ⇒ Object
- #set_user_agent_override(user_agent:, accept_language: nil, platform: nil, user_agent_metadata: nil) ⇒ Object
- #set_virtual_time_policy(policy:, budget: nil, max_virtual_time_task_starvation_count: nil, initial_virtual_time: nil) ⇒ Object
- #set_visible_size(width:, height:) ⇒ Object
Constructor Details
#initialize(devtools) ⇒ Emulation
Returns a new instance of Emulation.
29 30 31 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 29 def initialize(devtools) @devtools = devtools end |
Instance Method Details
#can_emulate ⇒ Object
38 39 40 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 38 def can_emulate @devtools.send_cmd('Emulation.canEmulate') end |
#clear_device_metrics_override ⇒ Object
42 43 44 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 42 def clear_device_metrics_override @devtools.send_cmd('Emulation.clearDeviceMetricsOverride') end |
#clear_device_posture_override ⇒ Object
97 98 99 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 97 def clear_device_posture_override @devtools.send_cmd('Emulation.clearDevicePostureOverride') end |
#clear_geolocation_override ⇒ Object
46 47 48 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 46 def clear_geolocation_override @devtools.send_cmd('Emulation.clearGeolocationOverride') end |
#clear_idle_override ⇒ Object
172 173 174 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 172 def clear_idle_override @devtools.send_cmd('Emulation.clearIdleOverride') end |
#get_overridden_sensor_information(type:) ⇒ Object
135 136 137 138 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 135 def get_overridden_sensor_information(type:) @devtools.send_cmd('Emulation.getOverriddenSensorInformation', type: type) end |
#on(event, &block) ⇒ Object
33 34 35 36 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 33 def on(event, &block) event = EVENTS[event] if event.is_a?(Symbol) @devtools.callbacks["Emulation.#{event}"] << block end |
#reset_page_scale_factor ⇒ Object
50 51 52 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 50 def reset_page_scale_factor @devtools.send_cmd('Emulation.resetPageScaleFactor') end |
#set_auto_dark_mode_override(enabled: nil) ⇒ Object
59 60 61 62 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 59 def set_auto_dark_mode_override(enabled: nil) @devtools.send_cmd('Emulation.setAutoDarkModeOverride', enabled: enabled) end |
#set_automation_override(enabled:) ⇒ Object
239 240 241 242 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 239 def set_automation_override(enabled:) @devtools.send_cmd('Emulation.setAutomationOverride', enabled: enabled) end |
#set_cpu_throttling_rate(rate:) ⇒ Object
64 65 66 67 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 64 def set_cpu_throttling_rate(rate:) @devtools.send_cmd('Emulation.setCPUThrottlingRate', rate: rate) end |
#set_default_background_color_override(color: nil) ⇒ Object
69 70 71 72 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 69 def set_default_background_color_override(color: nil) @devtools.send_cmd('Emulation.setDefaultBackgroundColorOverride', color: color) end |
#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, device_posture: nil) ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 74 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, device_posture: 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: , displayFeature: display_feature, devicePosture: device_posture) end |
#set_device_posture_override(posture:) ⇒ Object
92 93 94 95 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 92 def set_device_posture_override(posture:) @devtools.send_cmd('Emulation.setDevicePostureOverride', posture: posture) end |
#set_disabled_image_types(image_types:) ⇒ Object
221 222 223 224 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 221 def set_disabled_image_types(image_types:) @devtools.send_cmd('Emulation.setDisabledImageTypes', imageTypes: image_types) end |
#set_document_cookie_disabled(disabled:) ⇒ Object
106 107 108 109 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 106 def (disabled:) @devtools.send_cmd('Emulation.setDocumentCookieDisabled', disabled: disabled) end |
#set_emit_touch_events_for_mouse(enabled:, configuration: nil) ⇒ Object
111 112 113 114 115 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 111 def set_emit_touch_events_for_mouse(enabled:, configuration: nil) @devtools.send_cmd('Emulation.setEmitTouchEventsForMouse', enabled: enabled, configuration: configuration) end |
#set_emulated_media(media: nil, features: nil) ⇒ Object
117 118 119 120 121 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 117 def set_emulated_media(media: nil, features: nil) @devtools.send_cmd('Emulation.setEmulatedMedia', media: media, features: features) end |
#set_emulated_vision_deficiency(type:) ⇒ Object
123 124 125 126 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 123 def set_emulated_vision_deficiency(type:) @devtools.send_cmd('Emulation.setEmulatedVisionDeficiency', type: type) end |
#set_focus_emulation_enabled(enabled:) ⇒ Object
54 55 56 57 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 54 def set_focus_emulation_enabled(enabled:) @devtools.send_cmd('Emulation.setFocusEmulationEnabled', enabled: enabled) end |
#set_geolocation_override(latitude: nil, longitude: nil, accuracy: nil) ⇒ Object
128 129 130 131 132 133 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 128 def set_geolocation_override(latitude: nil, longitude: nil, accuracy: nil) @devtools.send_cmd('Emulation.setGeolocationOverride', latitude: latitude, longitude: longitude, accuracy: accuracy) end |
#set_hardware_concurrency_override(hardware_concurrency:) ⇒ Object
226 227 228 229 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 226 def set_hardware_concurrency_override(hardware_concurrency:) @devtools.send_cmd('Emulation.setHardwareConcurrencyOverride', hardwareConcurrency: hardware_concurrency) end |
#set_idle_override(is_user_active:, is_screen_unlocked:) ⇒ Object
166 167 168 169 170 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 166 def set_idle_override(is_user_active:, is_screen_unlocked:) @devtools.send_cmd('Emulation.setIdleOverride', isUserActive: is_user_active, isScreenUnlocked: is_screen_unlocked) end |
#set_locale_override(locale: nil) ⇒ Object
205 206 207 208 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 205 def set_locale_override(locale: nil) @devtools.send_cmd('Emulation.setLocaleOverride', locale: locale) end |
#set_navigator_overrides(platform:) ⇒ Object
176 177 178 179 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 176 def set_navigator_overrides(platform:) @devtools.send_cmd('Emulation.setNavigatorOverrides', platform: platform) end |
#set_page_scale_factor(page_scale_factor:) ⇒ Object
181 182 183 184 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 181 def set_page_scale_factor(page_scale_factor:) @devtools.send_cmd('Emulation.setPageScaleFactor', pageScaleFactor: page_scale_factor) end |
#set_pressure_source_override_enabled(enabled:, source:, metadata: nil) ⇒ Object
153 154 155 156 157 158 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 153 def set_pressure_source_override_enabled(enabled:, source:, metadata: nil) @devtools.send_cmd('Emulation.setPressureSourceOverrideEnabled', enabled: enabled, source: source, metadata: ) end |
#set_pressure_state_override(source:, state:) ⇒ Object
160 161 162 163 164 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 160 def set_pressure_state_override(source:, state:) @devtools.send_cmd('Emulation.setPressureStateOverride', source: source, state: state) end |
#set_script_execution_disabled(value:) ⇒ Object
186 187 188 189 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 186 def set_script_execution_disabled(value:) @devtools.send_cmd('Emulation.setScriptExecutionDisabled', value: value) end |
#set_scrollbars_hidden(hidden:) ⇒ Object
101 102 103 104 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 101 def (hidden:) @devtools.send_cmd('Emulation.setScrollbarsHidden', hidden: hidden) end |
#set_sensor_override_enabled(enabled:, type:, metadata: nil) ⇒ Object
140 141 142 143 144 145 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 140 def set_sensor_override_enabled(enabled:, type:, metadata: nil) @devtools.send_cmd('Emulation.setSensorOverrideEnabled', enabled: enabled, type: type, metadata: ) end |
#set_sensor_override_readings(type:, reading:) ⇒ Object
147 148 149 150 151 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 147 def set_sensor_override_readings(type:, reading:) @devtools.send_cmd('Emulation.setSensorOverrideReadings', type: type, reading: reading) end |
#set_timezone_override(timezone_id:) ⇒ Object
210 211 212 213 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 210 def set_timezone_override(timezone_id:) @devtools.send_cmd('Emulation.setTimezoneOverride', timezoneId: timezone_id) end |
#set_touch_emulation_enabled(enabled:, max_touch_points: nil) ⇒ Object
191 192 193 194 195 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 191 def set_touch_emulation_enabled(enabled:, max_touch_points: nil) @devtools.send_cmd('Emulation.setTouchEmulationEnabled', enabled: enabled, maxTouchPoints: max_touch_points) end |
#set_user_agent_override(user_agent:, accept_language: nil, platform: nil, user_agent_metadata: nil) ⇒ Object
231 232 233 234 235 236 237 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 231 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: ) end |
#set_virtual_time_policy(policy:, budget: nil, max_virtual_time_task_starvation_count: nil, initial_virtual_time: nil) ⇒ Object
197 198 199 200 201 202 203 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 197 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 |
#set_visible_size(width:, height:) ⇒ Object
215 216 217 218 219 |
# File 'lib/selenium/devtools/v129/emulation.rb', line 215 def set_visible_size(width:, height:) @devtools.send_cmd('Emulation.setVisibleSize', width: width, height: height) end |