Skip to main content
Transform your testing process with: Company-wide Licences, Test Observability & App Percy

Fix percyCSS for invalid DOM

Understand and address warnings related to Percy DOM Serialization for screenshot capture during the visual testing process.

Percy works by serializing the DOM and sending it to our infrastructure for capturing screenshots. The warning DOM elements found outside </body>, percyCSS might not work usually comes during the serialization of the DOM when there are elements positioned outside the </body> tag, leading to issues with the proper injection of percyCSS.

To address this issue, use the reshuffleInvalidTags: true (default is false) configuration. This attempts to reposition these elements inside the </body> tag.

This config option can be used globally in .percy.yml with the percy snapshotcommand, and at the per-snapshot level with both the percy snapshot command and the percySnapshot function.

Copy icon Copy snippet
Copy icon Copy snippet

Reference Topic

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback!

Talk to an Expert
Download Copy