rod icon indicating copy to clipboard operation
rod copied to clipboard

Is there a way to get css rules associated with an element ?

Open sunaynat opened this issue 1 year ago • 2 comments

Rod Version: v0.114.7

I have one element which has a css rule as

image

I want to validate this, is there a way to get the styles rules from the element ?

sunaynat avatar Feb 27 '24 10:02 sunaynat

Please fix the format of your markdown:

3:43 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
5:1 MD033/no-inline-html Inline HTML [Element: img]

generated by check-issue

github-actions[bot] avatar Feb 27 '24 10:02 github-actions[bot]

Yes, you can. Check the api in this file: https://github.com/go-rod/rod/blob/0243a30b10871506324281942f9b16eeb45fdc12/lib/proto/css.go#L19

https://github.com/go-rod/rod/blob/c35d2abd99a193ef49e21e02591cb6572269291f/examples_test.go#L410-L432

ysmood avatar Feb 28 '24 05:02 ysmood