-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[💡 Feature]: Allow second parameter to getCSSProperty to target pseudo elements, e.g. '::after' #7709
Comments
Thanks for proposing the idea @nikolajl! I think the structure you suggest works out, maybe we can be a bit more stricter about the pseudo element strings? So rather than defining it as Any contributions that implements this suggestion are highly appreciated. Please take a look into our contribution guidelines and let us know if you have any questions. Cheers! |
Hi @christian-bromann, I want to help with this issue. |
Awesome, let me know if you have any questions. |
@christian-bromann the |
You can generate types via |
Thanks. I misunderstood that the script will change base on TypeScript, but I actually have to go inside the JSON file and update the type. EDIT: I can't solve this, PR welcome. |
getCSSProperty utilizes browser getComputedStyle which allows passing a second parameter to get the pseudo element instead of the real element. The type defined by getComputedStyle for pseudo elements is string | null | undefined so I do the same. Constrain the type to literal string can be hard to maintain. Refs: webdriverio#7709
getCSSProperty utilizes browser getComputedStyle which allows passing a second parameter to get the pseudo element instead of the real element. The type defined by getComputedStyle for pseudo elements is string | null | undefined so I do the same. Constrain the type to literal string can be hard to maintain. Refs: webdriverio#7709
(#11570) * Enable to get css value of pseudo-element * removing browser from getCSSProperty params * moving getBrowserObject to getPseudoElementCSSValue * Update packages/webdriverio/src/commands/element/getCSSProperty.ts --------- Co-authored-by: Christian Bromann <git@bromann.dev>
@christian-bromann I guess this can be closed? 😄 |
Yes, thanks @Pawel1894 for working on this 👏 |
Is your feature request related to a problem?
I need to check a css style that is implemented as pseudo element
::after
.In the browser this is possible using
window.getComputedStyle(element, '::after')
. However, there is not an obvious way to do this in on the Element in WebdriverIO.Under the hood,
getCSSProperty()
uses getComputedStyle, but only allows 1 parameter. Allowing a second parameter would be an obvious simple solution.Describe the solution you'd like.
Add second parameter to
getCSSProperty()
Example:
Parameter would be added here.
webdriverio/packages/webdriverio/src/commands/element/getCSSProperty.ts
Line 73 in f858411
and then passed on to this one:
webdriverio/packages/devtools/src/scripts/getElementCSSValue.ts
Line 5 in f858411
Describe alternatives you've considered.
No response
Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: