java.lang.Object
org.openqa.selenium.devtools.v85.css.CSS

@Beta public class CSS extends 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 Details

    • CSS

      public CSS()
  • Method Details

    • addRule

      public static org.openqa.selenium.devtools.Command<CSSRule> addRule(StyleSheetId styleSheetId, 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<List<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<Void> disable()
      Disables the CSS agent for the given page.
    • enable

      public static org.openqa.selenium.devtools.Command<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<Void> forcePseudoState(NodeId nodeId, List<String> forcedPseudoClasses)
      Ensures that the given node will have specified pseudo-classes whenever its style is computed by the browser.
    • getBackgroundColors

      public static org.openqa.selenium.devtools.Command<CSS.GetBackgroundColorsResponse> getBackgroundColors(NodeId nodeId)
    • getComputedStyleForNode

      public static org.openqa.selenium.devtools.Command<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<List<CSSMedia>> getMediaQueries()
      Returns all media queries parsed by the rendering engine.
    • getPlatformFontsForNode

      public static org.openqa.selenium.devtools.Command<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<String> getStyleSheetText(StyleSheetId styleSheetId)
      Returns the current textual content for a stylesheet.
    • setEffectivePropertyValueForNode

      public static org.openqa.selenium.devtools.Command<Void> setEffectivePropertyValueForNode(NodeId nodeId, String propertyName, 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, String keyText)
      Modifies the keyframe rule key text.
    • setMediaText

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

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

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

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

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

      public static org.openqa.selenium.devtools.Command<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<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()