title: CYPRESS: Function to check if an button is disabled or not
body: <p>I have the following problem. I want to write a function that can be used to check whether the search button is deactivated or not. If the search button is deactivated, then carry out the next steps - fill out the search fields and click on the &quot;Start search&quot; button, and if the search button is activated, then first click on the button so that the search fields are displayed and then do the next steps - fill out the search fields and click on the button &quot;Start search&quot;. I've tried all sorts of things, but unfortunately without success.</p>
  <p>I would look forward to any help.</p>
  <p><a href="https://i.stack.imgur.com/1lEjv.png" rel="nofollow noreferrer">button is disabled</a></p>
  <p><a href="https://i.stack.imgur.com/hZbOk.png" rel="nofollow noreferrer">button is enabled</a></p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;button id="mainbody:searchPersRecord:searchIcon" name="mainbody:searchPersRecord:searchIcon" type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only btNormal showHeadArea ui-state-disabled" alt="Open search" title="Open search" onclick="showHeadArea(true); tryFocusComponentInAnyForm('searchHeadField1_Surname'); return false;;window.open('\/matrix\/views\/basis\/personalmanagement\/searchPersRecord.jsf','_self')" role="button" aria-disabled="false" disabled="disabled"&gt;&lt;span class="ui-button-icon-left ui-icon ui-c ma-icon ma-search"&gt;&lt;/span&gt;&lt;span class="ui-button-text ui-c"&gt;ui-button&lt;/span&gt;&lt;/button&gt;
  
  
  &lt;button id="mainbody:searchPersRecordDivisionForm:searchIcon" name="mainbody:searchPersRecordDivisionForm:searchIcon" type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only btNormal showHeadArea" alt="Open search" title="Open search" onclick="showHeadArea(true); tryFocusComponentInAnyForm('number'); return false;;window.open('\/matrix\/views\/basis\/personalmanagement\/searchDivision.jsf','_self')" role="button" aria-disabled="false"&gt;&lt;span class="ui-button-icon-left ui-icon ui-c ma-icon ma-search"&gt;&lt;/span&gt;&lt;span class="ui-button-text ui-c"&gt;ui-button&lt;/span&gt;&lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>