ATF - Failed to read the 'cssRules' property from 'CSSStyleSheet': Cannot access rules

Reddy26
Tera Contributor

I was facing the below error while asserting a text on a change form .There was a error message generated by g_form.addErrorMessage(). Ia m trying to validate whether its present on the form

Failed to read the 'cssRules' property from 'CSSStyleSheet': Cannot access rules

find_real_file.png

find_real_file.png

find_real_file.png

12 REPLIES 12

KHUSHBU CHHABLA
Tera Contributor

Did you find any solution on this?

 

OliverDoesereck
Tera Guru

I am looking for a solution too. We are experiencing the same issue:

- ATF Test: Assert Text on Page (Custom UI)

- Error Message: Failed to read the 'cssRules' property from 'CSSStyleSheet': Cannot access rules

OliverDoesereck
Tera Guru

I have found the issue and solution.

It seems there is a CSS Import issue in the DOM which causes the error message. Its not actually a fatal error but it does stop ATF from trying to assert for text.

To check whats happening:

1. Open the portal page in question (in my case it was a global issue, so the page didnt matter)

2. Open your browsers developer tools console (usually F12 for chromium)

3. Go to the console and type: window.document.styleSheets

4. Open the list of style sheets and check for any without cssRules like this:

find_real_file.png

5. Finding the source of the CSS might be an issue, but mine was a Service Portal Dependency (sp_dependency) with the option "Include on page load" activated and it was loading a CSS Include via URL (Source)

As soon as I removed the "Include on page load", the dependency wasnt being loaded on every page. It also seems including CSS via URL Sources skips creating the needed cssRule. Since fontAwesome 4.7.0 is included on every portal page by default, I have also removed the dependency completely.

Hi Oliver. Could you please tell me where exactly I can remove the "Include on page load" option? I have the console open but I am not able to see where is this option.