Développer ma barre des réalisations de la Communauté.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

Cette conversation a été verrouillée en raison de son inactivité. Veuillez créer une nouvelle publication.

RÉSOLU

Is AEM/Hobbes.Js able to automaticaly check for the value of a CSS atribute?

Avatar

Ex-membre de la communauté

I'm trying to automate a few tests with AEM/Hobbes.JS and one of the tasks is to make sure that the color of the texts are correct. For this, I would have to check the value of the "Color" attribute of the CSS that's applied to the text. However, from what I've seen in the documentation, the css classes that Hobbes.js has only check if the DOM attribute has the desired CSS class, not if the values inside the CSS are correct. I've also tried to execute a custom function to reach the CSS through the execFct()  method, but the custom JS code didn't work on it (Even though the code was correct, and worked if I tested it on Chrome's console). Is there any way for Hobbes.js / AEM to check for values inside the page's CSS, or is that not supported?

1 solution acceptée

Avatar

Réponse correcte par
Ex-membre de la communauté

For those who end up having the same problem, me and my coworker came up with a solution: by using de execFct() method, one can run custom Javascript code that reaches the attribute value of a CSS file using the getComputedStyle() and getPropertyValue() methods (as long as the hobs.context() function is used before the Javascript function. e.g. document.getElementById becomes hobs.context().document.getElementById().)

Voir la solution dans l'envoi d'origine

1 Reply

Avatar

Réponse correcte par
Ex-membre de la communauté

For those who end up having the same problem, me and my coworker came up with a solution: by using de execFct() method, one can run custom Javascript code that reaches the attribute value of a CSS file using the getComputedStyle() and getPropertyValue() methods (as long as the hobs.context() function is used before the Javascript function. e.g. document.getElementById becomes hobs.context().document.getElementById().)