Class CSS


  • @Beta
    public class CSS
    extends java.lang.Object
    This domain exposes CSS read/write operations. All CSS objects (stylesheets, rules, and styles) have an associated `id` used in subsequent operations on the related object. Each object type has a specific `id` structure, and those are not interchangeable between objects of different kinds. CSS objects can be loaded using the `get*ForNode()` calls (which accept a DOM node id). A client can also keep track of stylesheets via the `styleSheetAdded`/`styleSheetRemoved` events and subsequently load the required stylesheet contents using the `getStyleSheet[Text]()` methods.
    • Constructor Detail

      • CSS

        public CSS()
    • Method Detail

      • addRule

        public static org.openqa.selenium.devtools.Command<CSSRule> addRule​(StyleSheetId styleSheetId,
                                                                            java.lang.String ruleText,
                                                                            SourceRange location)
        Inserts a new rule with the given `ruleText` in a stylesheet with given `styleSheetId`, at the position specified by `location`.
      • collectClassNames

        public static org.openqa.selenium.devtools.Command<java.util.List<java.lang.String>> collectClassNames​(StyleSheetId styleSheetId)
        Returns all class names from specified stylesheet.
      • createStyleSheet

        public static org.openqa.selenium.devtools.Command<StyleSheetId> createStyleSheet​(FrameId frameId)
        Creates a new special "via-inspector" stylesheet in the frame with given `frameId`.
      • disable

        public static org.openqa.selenium.devtools.Command<java.lang.Void> disable()
        Disables the CSS agent for the given page.
      • enable

        public static org.openqa.selenium.devtools.Command<java.lang.Void> enable()
        Enables the CSS agent for the given page. Clients should not assume that the CSS agent has been enabled until the result of this command is received.
      • forcePseudoState

        public static org.openqa.selenium.devtools.Command<java.lang.Void> forcePseudoState​(NodeId nodeId,
                                                                                            java.util.List<java.lang.String> forcedPseudoClasses)
        Ensures that the given node will have specified pseudo-classes whenever its style is computed by the browser.
      • getComputedStyleForNode

        public static org.openqa.selenium.devtools.Command<java.util.List<CSSComputedStyleProperty>> getComputedStyleForNode​(NodeId nodeId)
        Returns the computed style for a DOM node identified by `nodeId`.
      • getInlineStylesForNode

        public static org.openqa.selenium.devtools.Command<CSS.GetInlineStylesForNodeResponse> getInlineStylesForNode​(NodeId nodeId)
        Returns the styles defined inline (explicitly in the "style" attribute and implicitly, using DOM attributes) for a DOM node identified by `nodeId`.
      • getMatchedStylesForNode

        public static org.openqa.selenium.devtools.Command<CSS.GetMatchedStylesForNodeResponse> getMatchedStylesForNode​(NodeId nodeId)
        Returns requested styles for a DOM node identified by `nodeId`.
      • getMediaQueries

        public static org.openqa.selenium.devtools.Command<java.util.List<CSSMedia>> getMediaQueries()
        Returns all media queries parsed by the rendering engine.
      • getPlatformFontsForNode

        public static org.openqa.selenium.devtools.Command<java.util.List<PlatformFontUsage>> getPlatformFontsForNode​(NodeId nodeId)
        Requests information about platform fonts which we used to render child TextNodes in the given node.
      • getStyleSheetText

        public static org.openqa.selenium.devtools.Command<java.lang.String> getStyleSheetText​(StyleSheetId styleSheetId)
        Returns the current textual content for a stylesheet.
      • setEffectivePropertyValueForNode

        public static org.openqa.selenium.devtools.Command<java.lang.Void> setEffectivePropertyValueForNode​(NodeId nodeId,
                                                                                                            java.lang.String propertyName,
                                                                                                            java.lang.String value)
        Find a rule with the given active property for the given node and set the new value for this property
      • setKeyframeKey

        public static org.openqa.selenium.devtools.Command<Value> setKeyframeKey​(StyleSheetId styleSheetId,
                                                                                 SourceRange range,
                                                                                 java.lang.String keyText)
        Modifies the keyframe rule key text.
      • setMediaText

        public static org.openqa.selenium.devtools.Command<CSSMedia> setMediaText​(StyleSheetId styleSheetId,
                                                                                  SourceRange range,
                                                                                  java.lang.String text)
        Modifies the rule selector.
      • setRuleSelector

        public static org.openqa.selenium.devtools.Command<SelectorList> setRuleSelector​(StyleSheetId styleSheetId,
                                                                                         SourceRange range,
                                                                                         java.lang.String selector)
        Modifies the rule selector.
      • setStyleSheetText

        public static org.openqa.selenium.devtools.Command<java.lang.String> setStyleSheetText​(StyleSheetId styleSheetId,
                                                                                               java.lang.String text)
        Sets the new stylesheet text.
      • setStyleTexts

        public static org.openqa.selenium.devtools.Command<java.util.List<CSSStyle>> setStyleTexts​(java.util.List<StyleDeclarationEdit> edits)
        Applies specified style edits one after another in the given order.
      • startRuleUsageTracking

        public static org.openqa.selenium.devtools.Command<java.lang.Void> startRuleUsageTracking()
        Enables the selector recording.
      • stopRuleUsageTracking

        public static org.openqa.selenium.devtools.Command<java.util.List<RuleUsage>> stopRuleUsageTracking()
        Stop tracking rule usage and return the list of rules that were used since last call to `takeCoverageDelta` (or since start of coverage instrumentation)
      • takeCoverageDelta

        public static org.openqa.selenium.devtools.Command<CSS.TakeCoverageDeltaResponse> takeCoverageDelta()
        Obtain list of rules that became used since last call to this method (or since start of coverage instrumentation)
      • fontsUpdated

        public static org.openqa.selenium.devtools.Event<FontFace> fontsUpdated()
      • mediaQueryResultChanged

        public static org.openqa.selenium.devtools.Event<java.lang.Void> mediaQueryResultChanged()
      • styleSheetAdded

        public static org.openqa.selenium.devtools.Event<CSSStyleSheetHeader> styleSheetAdded()
      • styleSheetChanged

        public static org.openqa.selenium.devtools.Event<StyleSheetId> styleSheetChanged()
      • styleSheetRemoved

        public static org.openqa.selenium.devtools.Event<StyleSheetId> styleSheetRemoved()