title: how to select the hidden element which is not on html in python
body: <p>I am currently trying to make the swipe right automation for Tinder. I wanted to select the hidden element which is not on html in python and click it to close the match popup.</p>
  <p>my code is</p>
  <pre><code>def close_match(self):
          is_match_popup_btn = self.driver.find_element_by_xpath('//*[@id=&quot;u-1959572593&quot;]/div/div/div[1]/div/div[4]/button').is_displayed()
          try:
              sleep(3)
              #if it is found, click it to close the popup
              if is_match_popup_btn:
                  is_match_popup_btn.click()
          except Exception:
              print(&quot;Something went wrong in close_match()&quot;)
         
  </code></pre>
  <p>I have got xpath of the match popup when I matched on tinder, but it keeps giving me an error on console:</p>
  <pre><code>selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {&quot;method&quot;:&quot;xpath&quot;,&quot;selector&quot;:&quot;//*[@id=&quot;u-1959572593&quot;]/div/div/div[1]/div/div[4]/button&quot;}
  </code></pre>
  <p>I know this error means there is no element I want to select because it is not on html, but is there a way to solve this problem?</p>
  <p>Things I am using:
  <code>Python 3.7.6</code>
  <code>chromedriver_mac64</code>
  <code>chrome=91.0.4472.114</code></p>