<script custom-tag="" type="application/ld+json">{"@context":"https://schema.org","@type":"TechArticle","headline":"ATF Custom UI steps can hang the client test runner or cause test failures if the page contains invalid HTML","image":"http://support.servicenow.com/29f1d2661baf6010cafa53d8624bcb43.iix","author":{"name":"ServiceNow Support","url":"http://support.servicenow.com/now"},"keywords":"ServiceNow, NowSupport public Knowledge Base articles, Known Error,KB1001141,","wordcount":"407","publisher":"ServiceNow","url":"https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1001141","datePublished":"2021-12-13","dateCreated":"2021-12-13","dateModified":"2024-11-12","description":"<h2>ATF Custom UI steps can hang the client test runner or cause test failures if the page contains invalid HTML</h2><br/><div style=\"overflow-x:auto\"><h2>Description</h2><div><p>When using ATF Custom","articleBody":"<h2>ATF Custom UI steps can hang the client test runner or cause test failures if the page contains invalid HTML</h2><br/><div style=\"overflow-x:auto\"><h2>Description</h2><div><p>When using ATF Custom UI steps to test a page that contains invalid HTML (for example, an invalid truncated tag like <sp...>), the test might fail unexpectedly.</p>\r\n<p>This issue only affects certain older Custom UI steps, and should not affect new steps created in Rome or later.</p></div><h2>Steps to Reproduce</h2><div> <p></p><p>Prerequisite: Have an instance with the "sn_atf.custom_ui.mugshot_version" sys_property set to "18.0" (e.g. an instance on the Paris release); or have a test that was created on such an instance</p>\r\n<p><br />Steps to reproduce:<br />1) Navigate to System UI > UI Pages module and click New<br />2) Input any name<br />3) For HTML, paste the following:<br /><?xml version="1.0" encoding="utf-8" ?><br /><j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null"><br /><br /><button>Click me</button><br /><div id="myDiv"></div><br /><br /></j:jelly><br /><br />4) For Client Script, paste the following:<br />gel("myDiv").innerHTML = "<sp...><div>Hello</div></sp...>";<br /><br />5) Submit the record<br />6) Navigate to Automated Test Framework (ATF) > Tests module and click New<br />7) Input any Name and click Save<br />8) In the Test Steps related list, click "Add Test Step"<br />9) Choose the Form > Open an Existing Record step and click "Next"<br />10) Set "Table" to "UI Page [sys_ui_page]" and "Record" to the UI page created in steps 1-5, then click "Submit"<br />11) Click "Add Test Step" again and choose "Form > Click a UI Action", then click "Next"<br />12) Set "UI Action" to "Try It" and click "Submit"<br />13) Click "Add Test Step" again and choose "Custom UI > Click Component (Custom UI)", then click "Next"<br />14) The "Retrieve Page Components" modal should now be displayed. Click "Retrieve Components" to continue<br />15) A new client test runner window should open (if one wasn't open already). Watch the test run<br />Expected: Test runs to completion and page components are retrieved successfully<br />Observed: Test starts running but eventually hangs with status message "Taking snapshot of the current page"</p>\r\n<p> </p>\r\n<p>Creating a Custom UI step on a valid HTML page and then updating the page to include invalid HTML (e.g. by removing the Client Script in Step 4, then adding it back in after creating the test) will cause the test to fail unexpectedly instead</p></div><h2>Workaround</h2><div><p>One workaround is to remove the invalid HTML from the page being tested.</p>\r\n<p>Alternatively, on a Rome or later instance, deleting the old Custom UI step and replacing it with a new one will also resolve the issue.</p></div><div><br /><strong>Related Problem: PRB1542484</strong></div></div>"}</script>