Class CSSAdapter
Represents an adapter for the CSS domain to simplify the command interface.
public class CSSAdapter
- Inheritance
-
CSSAdapter
- Inherited Members
Constructors
CSSAdapter(IDevToolsSession)
Initializes a new instance of the CSSAdapter class.
public CSSAdapter(IDevToolsSession session)
Parameters
sessionIDevToolsSessionThe IDevToolsSession to be used with this adapter.
Exceptions
- ArgumentNullException
If
sessionis null.
Properties
Session
Gets the DevToolsSession associated with the adapter.
public IDevToolsSession Session { get; }
Property Value
Methods
AddRule(AddRuleCommandSettings, CancellationToken, int?, bool)
Inserts a new rule with the given ruleText in a stylesheet with given styleSheetId, at the
position specified by location.
public Task<AddRuleCommandResponse> AddRule(AddRuleCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandAddRuleCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
CollectClassNames(CollectClassNamesCommandSettings, CancellationToken, int?, bool)
Returns all class names from specified stylesheet.
public Task<CollectClassNamesCommandResponse> CollectClassNames(CollectClassNamesCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandCollectClassNamesCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
CreateStyleSheet(CreateStyleSheetCommandSettings, CancellationToken, int?, bool)
Creates a new special "via-inspector" stylesheet in the frame with given frameId.
public Task<CreateStyleSheetCommandResponse> CreateStyleSheet(CreateStyleSheetCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandCreateStyleSheetCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
Disable(DisableCommandSettings?, CancellationToken, int?, bool)
Disables the CSS agent for the given page.
public Task<DisableCommandResponse?> Disable(DisableCommandSettings? command = null, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandDisableCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
Enable(EnableCommandSettings?, CancellationToken, int?, bool)
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.
public Task<EnableCommandResponse?> Enable(EnableCommandSettings? command = null, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandEnableCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
ForcePseudoState(ForcePseudoStateCommandSettings, CancellationToken, int?, bool)
Ensures that the given node will have specified pseudo-classes whenever its style is computed by the browser.
public Task<ForcePseudoStateCommandResponse?> ForcePseudoState(ForcePseudoStateCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandForcePseudoStateCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
ForceStartingStyle(ForceStartingStyleCommandSettings, CancellationToken, int?, bool)
Ensures that the given node is in its starting-style state.
public Task<ForceStartingStyleCommandResponse?> ForceStartingStyle(ForceStartingStyleCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandForceStartingStyleCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
GetAnimatedStylesForNode(GetAnimatedStylesForNodeCommandSettings, CancellationToken, int?, bool)
Returns the styles coming from animations & transitions including the animation & transition styles coming from inheritance chain.
public Task<GetAnimatedStylesForNodeCommandResponse> GetAnimatedStylesForNode(GetAnimatedStylesForNodeCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandGetAnimatedStylesForNodeCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
GetBackgroundColors(GetBackgroundColorsCommandSettings, CancellationToken, int?, bool)
getBackgroundColors
public Task<GetBackgroundColorsCommandResponse> GetBackgroundColors(GetBackgroundColorsCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandGetBackgroundColorsCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
GetComputedStyleForNode(GetComputedStyleForNodeCommandSettings, CancellationToken, int?, bool)
Returns the computed style for a DOM node identified by nodeId.
public Task<GetComputedStyleForNodeCommandResponse> GetComputedStyleForNode(GetComputedStyleForNodeCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandGetComputedStyleForNodeCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
GetEnvironmentVariables(GetEnvironmentVariablesCommandSettings?, CancellationToken, int?, bool)
Returns the values of the default UA-defined environment variables used in env()
public Task<GetEnvironmentVariablesCommandResponse> GetEnvironmentVariables(GetEnvironmentVariablesCommandSettings? command = null, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandGetEnvironmentVariablesCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
GetInlineStylesForNode(GetInlineStylesForNodeCommandSettings, CancellationToken, int?, bool)
Returns the styles defined inline (explicitly in the "style" attribute and implicitly, using DOM
attributes) for a DOM node identified by nodeId.
public Task<GetInlineStylesForNodeCommandResponse> GetInlineStylesForNode(GetInlineStylesForNodeCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandGetInlineStylesForNodeCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
GetLayersForNode(GetLayersForNodeCommandSettings, CancellationToken, int?, bool)
Returns all layers parsed by the rendering engine for the tree scope of a node. Given a DOM element identified by nodeId, getLayersForNode returns the root layer for the nearest ancestor document or shadow root. The layer root contains the full layer tree for the tree scope and their ordering.
public Task<GetLayersForNodeCommandResponse> GetLayersForNode(GetLayersForNodeCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandGetLayersForNodeCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
GetLocationForSelector(GetLocationForSelectorCommandSettings, CancellationToken, int?, bool)
Given a CSS selector text and a style sheet ID, getLocationForSelector returns an array of locations of the CSS selector in the style sheet.
public Task<GetLocationForSelectorCommandResponse> GetLocationForSelector(GetLocationForSelectorCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandGetLocationForSelectorCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
GetLonghandProperties(GetLonghandPropertiesCommandSettings, CancellationToken, int?, bool)
getLonghandProperties
public Task<GetLonghandPropertiesCommandResponse> GetLonghandProperties(GetLonghandPropertiesCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandGetLonghandPropertiesCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
GetMatchedStylesForNode(GetMatchedStylesForNodeCommandSettings, CancellationToken, int?, bool)
Returns requested styles for a DOM node identified by nodeId.
public Task<GetMatchedStylesForNodeCommandResponse> GetMatchedStylesForNode(GetMatchedStylesForNodeCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandGetMatchedStylesForNodeCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
GetMediaQueries(GetMediaQueriesCommandSettings?, CancellationToken, int?, bool)
Returns all media queries parsed by the rendering engine.
public Task<GetMediaQueriesCommandResponse> GetMediaQueries(GetMediaQueriesCommandSettings? command = null, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandGetMediaQueriesCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
GetPlatformFontsForNode(GetPlatformFontsForNodeCommandSettings, CancellationToken, int?, bool)
Requests information about platform fonts which we used to render child TextNodes in the given node.
public Task<GetPlatformFontsForNodeCommandResponse> GetPlatformFontsForNode(GetPlatformFontsForNodeCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandGetPlatformFontsForNodeCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
GetStyleSheetText(GetStyleSheetTextCommandSettings, CancellationToken, int?, bool)
Returns the current textual content for a stylesheet.
public Task<GetStyleSheetTextCommandResponse> GetStyleSheetText(GetStyleSheetTextCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandGetStyleSheetTextCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
ResolveValues(ResolveValuesCommandSettings, CancellationToken, int?, bool)
Resolve the specified values in the context of the provided element.
For example, a value of '1em' is evaluated according to the computed
'font-size' of the element and a value 'calc(1px + 2px)' will be
resolved to '3px'.
If the propertyName was specified the values are resolved as if
they were property's declaration. If a value cannot be parsed according
to the provided property syntax, the value is parsed using combined
syntax as if null propertyName was provided. If the value cannot be
resolved even then, return the provided value without any changes.
Note: this function currently does not resolve CSS random() function,
it returns unmodified random() function parts.`
public Task<ResolveValuesCommandResponse> ResolveValues(ResolveValuesCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandResolveValuesCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
SetContainerQueryText(SetContainerQueryTextCommandSettings, CancellationToken, int?, bool)
Modifies the expression of a container query.
public Task<SetContainerQueryTextCommandResponse> SetContainerQueryText(SetContainerQueryTextCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandSetContainerQueryTextCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
SetEffectivePropertyValueForNode(SetEffectivePropertyValueForNodeCommandSettings, CancellationToken, int?, bool)
Find a rule with the given active property for the given node and set the new value for this property
public Task<SetEffectivePropertyValueForNodeCommandResponse?> SetEffectivePropertyValueForNode(SetEffectivePropertyValueForNodeCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandSetEffectivePropertyValueForNodeCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
SetKeyframeKey(SetKeyframeKeyCommandSettings, CancellationToken, int?, bool)
Modifies the keyframe rule key text.
public Task<SetKeyframeKeyCommandResponse> SetKeyframeKey(SetKeyframeKeyCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandSetKeyframeKeyCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
SetLocalFontsEnabled(SetLocalFontsEnabledCommandSettings, CancellationToken, int?, bool)
Enables/disables rendering of local CSS fonts (enabled by default).
public Task<SetLocalFontsEnabledCommandResponse?> SetLocalFontsEnabled(SetLocalFontsEnabledCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandSetLocalFontsEnabledCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
SetMediaText(SetMediaTextCommandSettings, CancellationToken, int?, bool)
Modifies the rule selector.
public Task<SetMediaTextCommandResponse> SetMediaText(SetMediaTextCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandSetMediaTextCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
SetPropertyRulePropertyName(SetPropertyRulePropertyNameCommandSettings, CancellationToken, int?, bool)
Modifies the property rule property name.
public Task<SetPropertyRulePropertyNameCommandResponse> SetPropertyRulePropertyName(SetPropertyRulePropertyNameCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandSetPropertyRulePropertyNameCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
SetRuleSelector(SetRuleSelectorCommandSettings, CancellationToken, int?, bool)
Modifies the rule selector.
public Task<SetRuleSelectorCommandResponse> SetRuleSelector(SetRuleSelectorCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandSetRuleSelectorCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
SetScopeText(SetScopeTextCommandSettings, CancellationToken, int?, bool)
Modifies the expression of a scope at-rule.
public Task<SetScopeTextCommandResponse> SetScopeText(SetScopeTextCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandSetScopeTextCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
SetStyleSheetText(SetStyleSheetTextCommandSettings, CancellationToken, int?, bool)
Sets the new stylesheet text.
public Task<SetStyleSheetTextCommandResponse> SetStyleSheetText(SetStyleSheetTextCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandSetStyleSheetTextCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
SetStyleTexts(SetStyleTextsCommandSettings, CancellationToken, int?, bool)
Applies specified style edits one after another in the given order.
public Task<SetStyleTextsCommandResponse> SetStyleTexts(SetStyleTextsCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandSetStyleTextsCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
SetSupportsText(SetSupportsTextCommandSettings, CancellationToken, int?, bool)
Modifies the expression of a supports at-rule.
public Task<SetSupportsTextCommandResponse> SetSupportsText(SetSupportsTextCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandSetSupportsTextCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
StartRuleUsageTracking(StartRuleUsageTrackingCommandSettings?, CancellationToken, int?, bool)
Enables the selector recording.
public Task<StartRuleUsageTrackingCommandResponse?> StartRuleUsageTracking(StartRuleUsageTrackingCommandSettings? command = null, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandStartRuleUsageTrackingCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
StopRuleUsageTracking(StopRuleUsageTrackingCommandSettings?, CancellationToken, int?, bool)
Stop tracking rule usage and return the list of rules that were used since last call to
takeCoverageDelta (or since start of coverage instrumentation).
public Task<StopRuleUsageTrackingCommandResponse> StopRuleUsageTracking(StopRuleUsageTrackingCommandSettings? command = null, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandStopRuleUsageTrackingCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
TakeComputedStyleUpdates(TakeComputedStyleUpdatesCommandSettings?, CancellationToken, int?, bool)
Polls the next batch of computed style updates.
public Task<TakeComputedStyleUpdatesCommandResponse> TakeComputedStyleUpdates(TakeComputedStyleUpdatesCommandSettings? command = null, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandTakeComputedStyleUpdatesCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
TakeCoverageDelta(TakeCoverageDeltaCommandSettings?, CancellationToken, int?, bool)
Obtain list of rules that became used since last call to this method (or since start of coverage instrumentation).
public Task<TakeCoverageDeltaCommandResponse> TakeCoverageDelta(TakeCoverageDeltaCommandSettings? command = null, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandTakeCoverageDeltaCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
TrackComputedStyleUpdates(TrackComputedStyleUpdatesCommandSettings, CancellationToken, int?, bool)
Starts tracking the given computed styles for updates. The specified array of properties replaces the one previously specified. Pass empty array to disable tracking. Use takeComputedStyleUpdates to retrieve the list of nodes that had properties modified. The changes to computed style properties are only tracked for nodes pushed to the front-end by the DOM agent. If no changes to the tracked properties occur after the node has been pushed to the front-end, no updates will be issued for the node.
public Task<TrackComputedStyleUpdatesCommandResponse?> TrackComputedStyleUpdates(TrackComputedStyleUpdatesCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandTrackComputedStyleUpdatesCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
TrackComputedStyleUpdatesForNode(TrackComputedStyleUpdatesForNodeCommandSettings, CancellationToken, int?, bool)
Starts tracking the given node for the computed style updates
and whenever the computed style is updated for node, it queues
a computedStyleUpdated event with throttling.
There can only be 1 node tracked for computed style updates
so passing a new node id removes tracking from the previous node.
Pass undefined to disable tracking.
public Task<TrackComputedStyleUpdatesForNodeCommandResponse?> TrackComputedStyleUpdatesForNode(TrackComputedStyleUpdatesForNodeCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandTrackComputedStyleUpdatesForNodeCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
Events
ComputedStyleUpdated
computedStyleUpdated
public event EventHandler<ComputedStyleUpdatedEventArgs>? ComputedStyleUpdated
Event Type
FontsUpdated
Fires whenever a web font is updated. A non-empty font parameter indicates a successfully loaded web font.
public event EventHandler<FontsUpdatedEventArgs>? FontsUpdated
Event Type
MediaQueryResultChanged
Fires whenever a MediaQuery result changes (for example, after a browser window has been resized.) The current implementation considers only viewport-dependent media features.
public event EventHandler<MediaQueryResultChangedEventArgs>? MediaQueryResultChanged
Event Type
StyleSheetAdded
Fired whenever an active document stylesheet is added.
public event EventHandler<StyleSheetAddedEventArgs>? StyleSheetAdded
Event Type
StyleSheetChanged
Fired whenever a stylesheet is changed as a result of the client operation.
public event EventHandler<StyleSheetChangedEventArgs>? StyleSheetChanged
Event Type
StyleSheetRemoved
Fired whenever an active document stylesheet is removed.
public event EventHandler<StyleSheetRemovedEventArgs>? StyleSheetRemoved