Class CSS
java.lang.Object
org.openqa.selenium.devtools.v85.css.CSS
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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
static class
static class
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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
(StyleSheetId styleSheetId) Returns all class names from specified stylesheet.static org.openqa.selenium.devtools.Command<StyleSheetId>
createStyleSheet
(FrameId frameId) Creates a new special "via-inspector" stylesheet in the frame with given `frameId`.static org.openqa.selenium.devtools.Command<Void>
disable()
Disables the CSS agent for the given page.static org.openqa.selenium.devtools.Command<Void>
enable()
Enables the CSS agent for the given page.static org.openqa.selenium.devtools.Event<FontFace>
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.static org.openqa.selenium.devtools.Command<CSS.GetBackgroundColorsResponse>
getBackgroundColors
(NodeId nodeId) static org.openqa.selenium.devtools.Command<List<CSSComputedStyleProperty>>
getComputedStyleForNode
(NodeId nodeId) Returns the computed style for a DOM node identified by `nodeId`.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`.static org.openqa.selenium.devtools.Command<CSS.GetMatchedStylesForNodeResponse>
getMatchedStylesForNode
(NodeId nodeId) Returns requested styles for a DOM node identified by `nodeId`.Returns all media queries parsed by the rendering engine.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.static org.openqa.selenium.devtools.Command<String>
getStyleSheetText
(StyleSheetId styleSheetId) Returns the current textual content for a stylesheet.static org.openqa.selenium.devtools.Event<Void>
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 propertystatic org.openqa.selenium.devtools.Command<Value>
setKeyframeKey
(StyleSheetId styleSheetId, SourceRange range, String keyText) Modifies the keyframe rule key text.static org.openqa.selenium.devtools.Command<CSSMedia>
setMediaText
(StyleSheetId styleSheetId, SourceRange range, String text) Modifies the rule selector.static org.openqa.selenium.devtools.Command<SelectorList>
setRuleSelector
(StyleSheetId styleSheetId, SourceRange range, String selector) Modifies the rule selector.static org.openqa.selenium.devtools.Command<String>
setStyleSheetText
(StyleSheetId styleSheetId, String text) Sets the new stylesheet text.setStyleTexts
(List<StyleDeclarationEdit> edits) Applies specified style edits one after another in the given order.static org.openqa.selenium.devtools.Command<Void>
Enables the selector recording.Stop tracking rule usage and return the list of rules that were used since last call to `takeCoverageDelta` (or since start of coverage instrumentation)static org.openqa.selenium.devtools.Event<CSSStyleSheetHeader>
static org.openqa.selenium.devtools.Event<StyleSheetId>
static org.openqa.selenium.devtools.Event<StyleSheetId>
static org.openqa.selenium.devtools.Command<CSS.TakeCoverageDeltaResponse>
Obtain list of rules that became used since last call to this method (or since start of coverage instrumentation)
-
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
Creates a new special "via-inspector" stylesheet in the frame with given `frameId`. -
disable
Disables the CSS agent for the given page. -
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
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
Enables the selector recording. -
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
-
mediaQueryResultChanged
-
styleSheetAdded
-
styleSheetChanged
-
styleSheetRemoved
-