Class: Selenium::DevTools::V151::CSS

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/devtools/v151/css.rb

Constant Summary collapse

EVENTS =
{
  fonts_updated: 'fontsUpdated',
  media_query_result_changed: 'mediaQueryResultChanged',
  style_sheet_added: 'styleSheetAdded',
  style_sheet_changed: 'styleSheetChanged',
  style_sheet_removed: 'styleSheetRemoved',
  computed_style_updated: 'computedStyleUpdated',
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(devtools) ⇒ CSS

Returns a new instance of CSS.



35
36
37
# File 'lib/selenium/devtools/v151/css.rb', line 35

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#add_rule(style_sheet_id:, rule_text:, location:, node_for_property_syntax_validation: nil) ⇒ Object



44
45
46
47
48
49
50
# File 'lib/selenium/devtools/v151/css.rb', line 44

def add_rule(style_sheet_id:, rule_text:, location:, node_for_property_syntax_validation: nil)
  @devtools.send_cmd('CSS.addRule',
                     styleSheetId: style_sheet_id,
                     ruleText: rule_text,
                     location: location,
                     nodeForPropertySyntaxValidation: node_for_property_syntax_validation)
end

#collect_class_names(style_sheet_id:) ⇒ Object



52
53
54
55
# File 'lib/selenium/devtools/v151/css.rb', line 52

def collect_class_names(style_sheet_id:)
  @devtools.send_cmd('CSS.collectClassNames',
                     styleSheetId: style_sheet_id)
end

#create_style_sheet(frame_id:, force: nil) ⇒ Object



57
58
59
60
61
# File 'lib/selenium/devtools/v151/css.rb', line 57

def create_style_sheet(frame_id:, force: nil)
  @devtools.send_cmd('CSS.createStyleSheet',
                     frameId: frame_id,
                     force: force)
end

#disableObject



63
64
65
# File 'lib/selenium/devtools/v151/css.rb', line 63

def disable
  @devtools.send_cmd('CSS.disable')
end

#enableObject



67
68
69
# File 'lib/selenium/devtools/v151/css.rb', line 67

def enable
  @devtools.send_cmd('CSS.enable')
end

#force_pseudo_state(node_id:, forced_pseudo_classes:) ⇒ Object



71
72
73
74
75
# File 'lib/selenium/devtools/v151/css.rb', line 71

def force_pseudo_state(node_id:, forced_pseudo_classes:)
  @devtools.send_cmd('CSS.forcePseudoState',
                     nodeId: node_id,
                     forcedPseudoClasses: forced_pseudo_classes)
end

#force_starting_style(node_id:, forced:) ⇒ Object



77
78
79
80
81
# File 'lib/selenium/devtools/v151/css.rb', line 77

def force_starting_style(node_id:, forced:)
  @devtools.send_cmd('CSS.forceStartingStyle',
                     nodeId: node_id,
                     forced: forced)
end

#get_animated_styles_for_node(node_id:) ⇒ Object



113
114
115
116
# File 'lib/selenium/devtools/v151/css.rb', line 113

def get_animated_styles_for_node(node_id:)
  @devtools.send_cmd('CSS.getAnimatedStylesForNode',
                     nodeId: node_id)
end

#get_background_colors(node_id:) ⇒ Object



83
84
85
86
# File 'lib/selenium/devtools/v151/css.rb', line 83

def get_background_colors(node_id:)
  @devtools.send_cmd('CSS.getBackgroundColors',
                     nodeId: node_id)
end

#get_computed_style_for_node(node_id:) ⇒ Object



88
89
90
91
# File 'lib/selenium/devtools/v151/css.rb', line 88

def get_computed_style_for_node(node_id:)
  @devtools.send_cmd('CSS.getComputedStyleForNode',
                     nodeId: node_id)
end

#get_environment_variablesObject



123
124
125
# File 'lib/selenium/devtools/v151/css.rb', line 123

def get_environment_variables
  @devtools.send_cmd('CSS.getEnvironmentVariables')
end

#get_inline_styles_for_node(node_id:) ⇒ Object



108
109
110
111
# File 'lib/selenium/devtools/v151/css.rb', line 108

def get_inline_styles_for_node(node_id:)
  @devtools.send_cmd('CSS.getInlineStylesForNode',
                     nodeId: node_id)
end

#get_layers_for_node(node_id:) ⇒ Object



141
142
143
144
# File 'lib/selenium/devtools/v151/css.rb', line 141

def get_layers_for_node(node_id:)
  @devtools.send_cmd('CSS.getLayersForNode',
                     nodeId: node_id)
end

#get_location_for_selector(style_sheet_id:, selector_text:) ⇒ Object



146
147
148
149
150
# File 'lib/selenium/devtools/v151/css.rb', line 146

def get_location_for_selector(style_sheet_id:, selector_text:)
  @devtools.send_cmd('CSS.getLocationForSelector',
                     styleSheetId: style_sheet_id,
                     selectorText: selector_text)
end

#get_longhand_properties(shorthand_name:, value:) ⇒ Object



102
103
104
105
106
# File 'lib/selenium/devtools/v151/css.rb', line 102

def get_longhand_properties(shorthand_name:, value:)
  @devtools.send_cmd('CSS.getLonghandProperties',
                     shorthandName: shorthand_name,
                     value: value)
end

#get_matched_styles_for_node(node_id:) ⇒ Object



118
119
120
121
# File 'lib/selenium/devtools/v151/css.rb', line 118

def get_matched_styles_for_node(node_id:)
  @devtools.send_cmd('CSS.getMatchedStylesForNode',
                     nodeId: node_id)
end

#get_media_queriesObject



127
128
129
# File 'lib/selenium/devtools/v151/css.rb', line 127

def get_media_queries
  @devtools.send_cmd('CSS.getMediaQueries')
end

#get_platform_fonts_for_node(node_id:) ⇒ Object



131
132
133
134
# File 'lib/selenium/devtools/v151/css.rb', line 131

def get_platform_fonts_for_node(node_id:)
  @devtools.send_cmd('CSS.getPlatformFontsForNode',
                     nodeId: node_id)
end

#get_style_sheet_text(style_sheet_id:) ⇒ Object



136
137
138
139
# File 'lib/selenium/devtools/v151/css.rb', line 136

def get_style_sheet_text(style_sheet_id:)
  @devtools.send_cmd('CSS.getStyleSheetText',
                     styleSheetId: style_sheet_id)
end

#on(event, &block) ⇒ Object



39
40
41
42
# File 'lib/selenium/devtools/v151/css.rb', line 39

def on(event, &block)
  event = EVENTS[event] if event.is_a?(Symbol)
  @devtools.callbacks["CSS.#{event}"] << block
end

#resolve_values(values:, node_id:, property_name: nil, pseudo_type: nil, pseudo_identifier: nil) ⇒ Object



93
94
95
96
97
98
99
100
# File 'lib/selenium/devtools/v151/css.rb', line 93

def resolve_values(values:, node_id:, property_name: nil, pseudo_type: nil, pseudo_identifier: nil)
  @devtools.send_cmd('CSS.resolveValues',
                     values: values,
                     nodeId: node_id,
                     propertyName: property_name,
                     pseudoType: pseudo_type,
                     pseudoIdentifier: pseudo_identifier)
end

#set_container_query_condition_text(style_sheet_id:, range:, text:) ⇒ Object



201
202
203
204
205
206
# File 'lib/selenium/devtools/v151/css.rb', line 201

def set_container_query_condition_text(style_sheet_id:, range:, text:)
  @devtools.send_cmd('CSS.setContainerQueryConditionText',
                     styleSheetId: style_sheet_id,
                     range: range,
                     text: text)
end

#set_container_query_text(style_sheet_id:, range:, text:) ⇒ Object



194
195
196
197
198
199
# File 'lib/selenium/devtools/v151/css.rb', line 194

def set_container_query_text(style_sheet_id:, range:, text:)
  @devtools.send_cmd('CSS.setContainerQueryText',
                     styleSheetId: style_sheet_id,
                     range: range,
                     text: text)
end

#set_effective_property_value_for_node(node_id:, property_name:, value:) ⇒ Object



166
167
168
169
170
171
# File 'lib/selenium/devtools/v151/css.rb', line 166

def set_effective_property_value_for_node(node_id:, property_name:, value:)
  @devtools.send_cmd('CSS.setEffectivePropertyValueForNode',
                     nodeId: node_id,
                     propertyName: property_name,
                     value: value)
end

#set_keyframe_key(style_sheet_id:, range:, key_text:) ⇒ Object



180
181
182
183
184
185
# File 'lib/selenium/devtools/v151/css.rb', line 180

def set_keyframe_key(style_sheet_id:, range:, key_text:)
  @devtools.send_cmd('CSS.setKeyframeKey',
                     styleSheetId: style_sheet_id,
                     range: range,
                     keyText: key_text)
end

#set_local_fonts_enabled(enabled:) ⇒ Object



260
261
262
263
# File 'lib/selenium/devtools/v151/css.rb', line 260

def set_local_fonts_enabled(enabled:)
  @devtools.send_cmd('CSS.setLocalFontsEnabled',
                     enabled: enabled)
end

#set_media_text(style_sheet_id:, range:, text:) ⇒ Object



187
188
189
190
191
192
# File 'lib/selenium/devtools/v151/css.rb', line 187

def set_media_text(style_sheet_id:, range:, text:)
  @devtools.send_cmd('CSS.setMediaText',
                     styleSheetId: style_sheet_id,
                     range: range,
                     text: text)
end

#set_navigation_text(style_sheet_id:, range:, text:) ⇒ Object



215
216
217
218
219
220
# File 'lib/selenium/devtools/v151/css.rb', line 215

def set_navigation_text(style_sheet_id:, range:, text:)
  @devtools.send_cmd('CSS.setNavigationText',
                     styleSheetId: style_sheet_id,
                     range: range,
                     text: text)
end

#set_property_rule_property_name(style_sheet_id:, range:, property_name:) ⇒ Object



173
174
175
176
177
178
# File 'lib/selenium/devtools/v151/css.rb', line 173

def set_property_rule_property_name(style_sheet_id:, range:, property_name:)
  @devtools.send_cmd('CSS.setPropertyRulePropertyName',
                     styleSheetId: style_sheet_id,
                     range: range,
                     propertyName: property_name)
end

#set_rule_selector(style_sheet_id:, range:, selector:) ⇒ Object



229
230
231
232
233
234
# File 'lib/selenium/devtools/v151/css.rb', line 229

def set_rule_selector(style_sheet_id:, range:, selector:)
  @devtools.send_cmd('CSS.setRuleSelector',
                     styleSheetId: style_sheet_id,
                     range: range,
                     selector: selector)
end

#set_scope_text(style_sheet_id:, range:, text:) ⇒ Object



222
223
224
225
226
227
# File 'lib/selenium/devtools/v151/css.rb', line 222

def set_scope_text(style_sheet_id:, range:, text:)
  @devtools.send_cmd('CSS.setScopeText',
                     styleSheetId: style_sheet_id,
                     range: range,
                     text: text)
end

#set_style_sheet_text(style_sheet_id:, text:) ⇒ Object



236
237
238
239
240
# File 'lib/selenium/devtools/v151/css.rb', line 236

def set_style_sheet_text(style_sheet_id:, text:)
  @devtools.send_cmd('CSS.setStyleSheetText',
                     styleSheetId: style_sheet_id,
                     text: text)
end

#set_style_texts(edits:, node_for_property_syntax_validation: nil) ⇒ Object



242
243
244
245
246
# File 'lib/selenium/devtools/v151/css.rb', line 242

def set_style_texts(edits:, node_for_property_syntax_validation: nil)
  @devtools.send_cmd('CSS.setStyleTexts',
                     edits: edits,
                     nodeForPropertySyntaxValidation: node_for_property_syntax_validation)
end

#set_supports_text(style_sheet_id:, range:, text:) ⇒ Object



208
209
210
211
212
213
# File 'lib/selenium/devtools/v151/css.rb', line 208

def set_supports_text(style_sheet_id:, range:, text:)
  @devtools.send_cmd('CSS.setSupportsText',
                     styleSheetId: style_sheet_id,
                     range: range,
                     text: text)
end

#start_rule_usage_trackingObject



248
249
250
# File 'lib/selenium/devtools/v151/css.rb', line 248

def start_rule_usage_tracking
  @devtools.send_cmd('CSS.startRuleUsageTracking')
end

#stop_rule_usage_trackingObject



252
253
254
# File 'lib/selenium/devtools/v151/css.rb', line 252

def stop_rule_usage_tracking
  @devtools.send_cmd('CSS.stopRuleUsageTracking')
end

#take_computed_style_updatesObject



162
163
164
# File 'lib/selenium/devtools/v151/css.rb', line 162

def take_computed_style_updates
  @devtools.send_cmd('CSS.takeComputedStyleUpdates')
end

#take_coverage_deltaObject



256
257
258
# File 'lib/selenium/devtools/v151/css.rb', line 256

def take_coverage_delta
  @devtools.send_cmd('CSS.takeCoverageDelta')
end

#track_computed_style_updates(properties_to_track:) ⇒ Object



157
158
159
160
# File 'lib/selenium/devtools/v151/css.rb', line 157

def track_computed_style_updates(properties_to_track:)
  @devtools.send_cmd('CSS.trackComputedStyleUpdates',
                     propertiesToTrack: properties_to_track)
end

#track_computed_style_updates_for_node(node_id: nil) ⇒ Object



152
153
154
155
# File 'lib/selenium/devtools/v151/css.rb', line 152

def track_computed_style_updates_for_node(node_id: nil)
  @devtools.send_cmd('CSS.trackComputedStyleUpdatesForNode',
                     nodeId: node_id)
end