# 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 V136
class CSS
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
def initialize(devtools)
@devtools = devtools
end
def on(event, &block)
event = EVENTS[event] if event.is_a?(Symbol)
@devtools.callbacks["CSS.#{event}"] << block
end
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
def collect_class_names(style_sheet_id:)
@devtools.send_cmd('CSS.collectClassNames',
styleSheetId: style_sheet_id)
end
def create_style_sheet(frame_id:, force: nil)
@devtools.send_cmd('CSS.createStyleSheet',
frameId: frame_id,
force: force)
end
def disable
@devtools.send_cmd('CSS.disable')
end
def enable
@devtools.send_cmd('CSS.enable')
end
def force_pseudo_state(node_id:, forced_pseudo_classes:)
@devtools.send_cmd('CSS.forcePseudoState',
nodeId: node_id,
forcedPseudoClasses: forced_pseudo_classes)
end
def force_starting_style(node_id:, forced:)
@devtools.send_cmd('CSS.forceStartingStyle',
nodeId: node_id,
forced: forced)
end
def get_background_colors(node_id:)
@devtools.send_cmd('CSS.getBackgroundColors',
nodeId: node_id)
end
def get_computed_style_for_node(node_id:)
@devtools.send_cmd('CSS.getComputedStyleForNode',
nodeId: node_id)
end
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
def get_longhand_properties(shorthand_name:, value:)
@devtools.send_cmd('CSS.getLonghandProperties',
shorthandName: shorthand_name,
value: value)
end
def get_inline_styles_for_node(node_id:)
@devtools.send_cmd('CSS.getInlineStylesForNode',
nodeId: node_id)
end
def get_animated_styles_for_node(node_id:)
@devtools.send_cmd('CSS.getAnimatedStylesForNode',
nodeId: node_id)
end
def get_matched_styles_for_node(node_id:)
@devtools.send_cmd('CSS.getMatchedStylesForNode',
nodeId: node_id)
end
def get_media_queries
@devtools.send_cmd('CSS.getMediaQueries')
end
def get_platform_fonts_for_node(node_id:)
@devtools.send_cmd('CSS.getPlatformFontsForNode',
nodeId: node_id)
end
def get_style_sheet_text(style_sheet_id:)
@devtools.send_cmd('CSS.getStyleSheetText',
styleSheetId: style_sheet_id)
end
def get_layers_for_node(node_id:)
@devtools.send_cmd('CSS.getLayersForNode',
nodeId: node_id)
end
def get_location_for_selector(style_sheet_id:, selector_text:)
@devtools.send_cmd('CSS.getLocationForSelector',
styleSheetId: style_sheet_id,
selectorText: selector_text)
end
def track_computed_style_updates_for_node(node_id: nil)
@devtools.send_cmd('CSS.trackComputedStyleUpdatesForNode',
nodeId: node_id)
end
def track_computed_style_updates(properties_to_track:)
@devtools.send_cmd('CSS.trackComputedStyleUpdates',
propertiesToTrack: properties_to_track)
end
def take_computed_style_updates
@devtools.send_cmd('CSS.takeComputedStyleUpdates')
end
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
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
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
def set_media_text(style_sheet_id:, range:, text:)
@devtools.send_cmd('CSS.setMediaText',
styleSheetId: style_sheet_id,
range: range,
text: text)
end
def set_container_query_text(style_sheet_id:, range:, text:)
@devtools.send_cmd('CSS.setContainerQueryText',
styleSheetId: style_sheet_id,
range: range,
text: text)
end
def set_supports_text(style_sheet_id:, range:, text:)
@devtools.send_cmd('CSS.setSupportsText',
styleSheetId: style_sheet_id,
range: range,
text: text)
end
def set_scope_text(style_sheet_id:, range:, text:)
@devtools.send_cmd('CSS.setScopeText',
styleSheetId: style_sheet_id,
range: range,
text: text)
end
def set_rule_selector(style_sheet_id:, range:, selector:)
@devtools.send_cmd('CSS.setRuleSelector',
styleSheetId: style_sheet_id,
range: range,
selector: selector)
end
def set_style_sheet_text(style_sheet_id:, text:)
@devtools.send_cmd('CSS.setStyleSheetText',
styleSheetId: style_sheet_id,
text: text)
end
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
def start_rule_usage_tracking
@devtools.send_cmd('CSS.startRuleUsageTracking')
end
def stop_rule_usage_tracking
@devtools.send_cmd('CSS.stopRuleUsageTracking')
end
def take_coverage_delta
@devtools.send_cmd('CSS.takeCoverageDelta')
end
def set_local_fonts_enabled(enabled:)
@devtools.send_cmd('CSS.setLocalFontsEnabled',
enabled: enabled)
end
end # CSS
end # V136
end # DevTools
end # Selenium