title: How to get id of invisible element in fragment?
body: <p>I have a Dialog in fragment:</p>
  <pre><code>&lt;core:FragmentDefinition
      xmlns=&quot;sap.m&quot;
      xmlns:f=&quot;sap.ui.layout.form&quot;
      xmlns:core=&quot;sap.ui.core&quot;&gt;
      &lt;Dialog title=&quot;{i18n&gt;AddNewItem}&quot; resizable=&quot;true&quot; draggable=&quot;true&quot;&gt;
          &lt;content&gt;
              &lt;MessageStrip
                  id=&quot;failMsg&quot;
                  visible=&quot;false&quot;
                  text=&quot;{i18n&gt;SensorTypesCreateFail}&quot;
                  type=&quot;Error&quot;
                  showIcon=&quot;true&quot;/&gt;
      &lt;/Dialog&gt;
  &lt;/core:FragmentDefinition&gt;
  </code></pre>
  <p>As in <a href="https://openui5.hana.ondemand.com/#/topic/8b325518a2ae48ee91eb2dacda1d1420" rel="nofollow noreferrer">UI5 doc</a>：</p>
  <blockquote>
  <p>Retrieving a control instance when the fragment is not part of a view:</p>
  <ul>
  <li><p>When no fragment ID was given: myControl = sap.ui.getCore().byId(&quot;myControl&quot;)</p>
  </li>
  <li><p>When a fragment ID myFrag was given:  myControl = sap.ui.core.Fragment.byId(&quot;myFrag&quot;, &quot;myControl&quot;)</p>
  </li>
  </ul>
  </blockquote>
  <p>If there is no <code>visible=&quot;false&quot;</code>, I can get this MessageStrip by <code>sap.ui.getCore().byId(&quot;failMsg&quot;)</code>.</p>
  <p>But I found that with <code>visible=&quot;false&quot;</code>, id of MessageStrip is <code>sap-ui-invisible-failMsg</code>, I failed to found proper API to get it.</p>
  <p>Of course I can use <code>sap.ui.getCore().byId(&quot;sap-ui-invisible-failMsg&quot;)</code>, but I am not sure whether this ID will change after I deploy it to FLP, and as @schnoedel said in <a href="https://stackoverflow.com/questions/39660161/sapui5-xml-fragment-access-element-by-id">another question</a>:</p>
  <blockquote>
  <p>Beware that the prefixes like -- and --- used by the framework may change in the future. Thats why it's recommended to use the public api functions the framework supplies like byId() and createId().</p>
  </blockquote>
  <p>So, is there any better way to get it?</p>
  <hr />
  <p>Update:</p>
  <p>Change my code from:</p>
  <pre><code>this[dialogName] = sap.ui.xmlfragment(&quot;namespace.&quot; + dialogName, this);
  this.getView().addDependent(this[dialogName]);
  </code></pre>
  <p>To</p>
  <pre><code>this[dialogName] = sap.ui.xmlfragment(dialogName, &quot;namespace.&quot; + dialogName, this);
  this.getView().addDependent(this[dialogName]);
  </code></pre>
  <p>And now my id is <code>sap-ui-invisible-dialogName--failMsg</code>...</p>