Class: Selenium::DevTools::V85::CSS

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/devtools/v85/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/v85/css.rb', line 33

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

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



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

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

#collect_class_names(style_sheet_id:) ⇒ Object



49
50
51
52
# File 'lib/selenium/devtools/v85/css.rb', line 49

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

#create_style_sheet(frame_id:) ⇒ Object



54
55
56
57
# File 'lib/selenium/devtools/v85/css.rb', line 54

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

#disableObject



59
60
61
# File 'lib/selenium/devtools/v85/css.rb', line 59

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

#enableObject



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

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

#force_pseudo_state(node_id:, forced_pseudo_classes:) ⇒ Object



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

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



73
74
75
76
# File 'lib/selenium/devtools/v85/css.rb', line 73

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

#get_computed_style_for_node(node_id:) ⇒ Object



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

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



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

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

#get_matched_styles_for_node(node_id:) ⇒ Object



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

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

#get_media_queriesObject



93
94
95
# File 'lib/selenium/devtools/v85/css.rb', line 93

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

#get_platform_fonts_for_node(node_id:) ⇒ Object



97
98
99
100
# File 'lib/selenium/devtools/v85/css.rb', line 97

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



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

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/v85/css.rb', line 37

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

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



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

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



114
115
116
117
118
119
# File 'lib/selenium/devtools/v85/css.rb', line 114

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_media_text(style_sheet_id:, range:, text:) ⇒ Object



121
122
123
124
125
126
# File 'lib/selenium/devtools/v85/css.rb', line 121

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

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



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

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

#set_style_sheet_text(style_sheet_id:, text:) ⇒ Object



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

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:) ⇒ Object



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

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

#start_rule_usage_trackingObject



146
147
148
# File 'lib/selenium/devtools/v85/css.rb', line 146

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

#stop_rule_usage_trackingObject



150
151
152
# File 'lib/selenium/devtools/v85/css.rb', line 150

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

#take_coverage_deltaObject



154
155
156
# File 'lib/selenium/devtools/v85/css.rb', line 154

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