Class: Selenium::DevTools::V130::CSS

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/devtools/v130/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',
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(devtools) ⇒ CSS

Returns a new instance of CSS.



33
34
35
# File 'lib/selenium/devtools/v130/css.rb', line 33

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

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



42
43
44
45
46
47
48
# File 'lib/selenium/devtools/v130/css.rb', line 42

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



50
51
52
53
# File 'lib/selenium/devtools/v130/css.rb', line 50

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

#create_style_sheet(frame_id:) ⇒ Object



55
56
57
58
# File 'lib/selenium/devtools/v130/css.rb', line 55

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

#disableObject



60
61
62
# File 'lib/selenium/devtools/v130/css.rb', line 60

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

#enableObject



64
65
66
# File 'lib/selenium/devtools/v130/css.rb', line 64

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

#force_pseudo_state(node_id:, forced_pseudo_classes:) ⇒ Object



68
69
70
71
72
# File 'lib/selenium/devtools/v130/css.rb', line 68

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

#get_background_colors(node_id:) ⇒ Object



74
75
76
77
# File 'lib/selenium/devtools/v130/css.rb', line 74

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

#get_computed_style_for_node(node_id:) ⇒ Object



79
80
81
82
# File 'lib/selenium/devtools/v130/css.rb', line 79

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

#get_inline_styles_for_node(node_id:) ⇒ Object



84
85
86
87
# File 'lib/selenium/devtools/v130/css.rb', line 84

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

#get_layers_for_node(node_id:) ⇒ Object



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

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



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

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

#get_matched_styles_for_node(node_id:) ⇒ Object



89
90
91
92
# File 'lib/selenium/devtools/v130/css.rb', line 89

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

#get_media_queriesObject



94
95
96
# File 'lib/selenium/devtools/v130/css.rb', line 94

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

#get_platform_fonts_for_node(node_id:) ⇒ Object



98
99
100
101
# File 'lib/selenium/devtools/v130/css.rb', line 98

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



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

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

#on(event, &block) ⇒ Object



37
38
39
40
# File 'lib/selenium/devtools/v130/css.rb', line 37

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

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



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

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



128
129
130
131
132
133
# File 'lib/selenium/devtools/v130/css.rb', line 128

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



142
143
144
145
146
147
# File 'lib/selenium/devtools/v130/css.rb', line 142

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



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

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

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



149
150
151
152
153
154
# File 'lib/selenium/devtools/v130/css.rb', line 149

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

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



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

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



177
178
179
180
181
182
# File 'lib/selenium/devtools/v130/css.rb', line 177

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



170
171
172
173
174
175
# File 'lib/selenium/devtools/v130/css.rb', line 170

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



184
185
186
187
188
# File 'lib/selenium/devtools/v130/css.rb', line 184

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



190
191
192
193
194
# File 'lib/selenium/devtools/v130/css.rb', line 190

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



163
164
165
166
167
168
# File 'lib/selenium/devtools/v130/css.rb', line 163

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



196
197
198
# File 'lib/selenium/devtools/v130/css.rb', line 196

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

#stop_rule_usage_trackingObject



200
201
202
# File 'lib/selenium/devtools/v130/css.rb', line 200

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

#take_computed_style_updatesObject



124
125
126
# File 'lib/selenium/devtools/v130/css.rb', line 124

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

#take_coverage_deltaObject



204
205
206
# File 'lib/selenium/devtools/v130/css.rb', line 204

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

#track_computed_style_updates(properties_to_track:) ⇒ Object



119
120
121
122
# File 'lib/selenium/devtools/v130/css.rb', line 119

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