title: How to send ESC key to close pop up window using Python and Selenium?
body: <p>As mentioned, is there a way to send global <code>ESC</code> key to close popup(CSS MODAL Window)? I tried following but did not work:</p>
  
  <pre><code>driver.find_element_by_tag_name('body').send_keys(Keys.ESCAPE)
  </code></pre>
  
  <p>I know I can use xPath etc but issue is the site has dynamic elementIds and classnames.</p>