<script custom-tag="" type="application/ld+json">{"@context":"https://schema.org","@type":"TechArticle","headline":"ATF Custom UI can not distinguish between multiple identical components","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,KB0789969,","wordcount":"368","publisher":"ServiceNow","url":"https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0789969","datePublished":"2020-01-23","dateCreated":"2019-12-17","dateModified":"2023-03-22","description":"<h2>ATF Custom UI can not distinguish between multiple identical components</h2><br/><div style=\"overflow-x:auto\"><h2>Description</h2><div><p>ATF will still click the first button after the page devel","articleBody":"<h2>ATF Custom UI can not distinguish between multiple identical components</h2><br/><div style=\"overflow-x:auto\"><h2>Description</h2><div><p>ATF will still click the first button after the page developer has removed the button defined in an ATF Custom UI step.</p>\r\n<p> </p></div><h2>Steps to Reproduce</h2><div> <p></p><p>1. Navigate to the &#34;System UI &gt; UI Pages&#34; module and select &#34;New&#34;.<br /><br />2. Fill out the fields as follows:<br />&#34;Name&#34; &#61; &lt;any value&gt;<br />&#34;HTML&#34; &#61; <br /><span style=\"font-family: &#39;courier new&#39;, courier;\">&lt;?xml version&#61;&#34;1.0&#34; encoding&#61;&#34;utf-8&#34; ?&gt;</span><br /><span style=\"font-family: &#39;courier new&#39;, courier;\">&lt;j:jelly trim&#61;&#34;false&#34; xmlns:j&#61;&#34;jelly:core&#34; xmlns:g&#61;&#34;glide&#34; xmlns:j2&#61;&#34;null&#34; xmlns:g2&#61;&#34;null&#34;&gt;</span><br /><span style=\"font-family: &#39;courier new&#39;, courier;\">&lt;div id&#61;&#34;mydiv&#34;&gt;&lt;/div&gt;</span><br /><span style=\"font-family: &#39;courier new&#39;, courier;\">&lt;div&gt;&lt;button onclick&#61;&#34;foo(&#39;First&#39;)&#34;&gt;Click me!&lt;/button&gt;&lt;/div&gt;</span><br /><span style=\"font-family: &#39;courier new&#39;, courier;\">&lt;div&gt;&lt;button onclick&#61;&#34;foo(&#39;Second&#39;)&#34;&gt;Click me!&lt;/button&gt;&lt;/div&gt;</span><br /><span style=\"font-family: &#39;courier new&#39;, courier;\">&lt;div&gt;&lt;button onclick&#61;&#34;foo(&#39;Third&#39;)&#34;&gt;Click me!&lt;/button&gt;&lt;/div&gt;</span><br /><span style=\"font-family: &#39;courier new&#39;, courier;\">&lt;/j:jelly&gt;</span><br />&#34;Client script&#34; &#61; <br /><span style=\"font-family: &#39;courier new&#39;, courier;\">function foo(msg) {</span><br /><span style=\"font-family: &#39;courier new&#39;, courier;\">gel(&#39;mydiv&#39;).innerText &#61; msg;</span><br /><span style=\"font-family: &#39;courier new&#39;, courier;\">}</span><br /><br />3. Click on &#34;Submit&#34;.<br />4. Navigate to the &#34;Automated Test Framework (ATF) &gt; Tests&#34; module, click &#34;New&#34; and then &#34;Save&#34;.<br />5. Click &#34;Add Test Step&#34;, then &#34;Form&#34;, then &#34;Open an Existing Record&#34; and &#34;Next&#34;.<br />6. Set &#34;Table&#34; to &#34;UI Page&#34; and &#34;Record&#34; to the record created in step 1-3, then click &#34;Submit&#34;.<br />7. Click Add Test Step &gt; Form &gt; Click a UI Action, then &#34;Next&#34;.<br />8. Set &#34;UI Action&#34; to &#34;Try It&#34; and click &#34;Submit&#34;.<br />9. Click Add Test Step &gt; Custom UI &gt; Click Component (Custom UI) then click &#34;Next&#34;.<br />10. When prompted click &#34;Retrieve components&#34;, allow the test to run to completion in the tab it opens, then go back to the test designed and click &#34;Next&#34;.<br />11. In the component dropdown select any of the &#34;Button &lt;button&gt;: Click me!&#34; components then click &#34;Submit&#34;.<br />12. Click &#34;Run&#34; and then &#34;Run Test&#34; if prompted.<br /><br />Observe not all the buttons can be clicked by navigating back to the &#34;Click Component (Custom UI)&#34; step and changing the component dropdown. No matter which one of the &#34;Button &lt;button&gt;: Click me!&#34; components are selected, it will only ever click on the very first one, making it impossible to click the &#34;Second&#34; or &#34;Third&#34; buttons.<br /><br /></p></div><h2>Workaround</h2><div><p>This issue has been addressed in Rome. The ATF is better equipped to find and interact with multiple identical UI Components / html elements on the page.</p></div><div><br /><strong>Related Problem: PRB1356037</strong></div></div>"}</script>
  Loading...