title: IF / THEN Statement in Selenium
body: <p>I run this code</p>
  <pre><code>#Gets to the Calendar for the week with the Login Details
  
  calendar = driver.get('https://www.investing.com/economic-calendar/')
  
  time.sleep(5)
  
  driver.find_element_by_xpath('/html/body/div[9]/div[3]')
  
  driver.find_element_by_xpath('//*[@id=&quot;onetrust-accept-btn-handler&quot;]').click()
  
  time.sleep(5)
  
  driver.find_element_by_xpath('/html/body/div[10]/div')
  
  driver.find_element_by_xpath('/html/body/div[10]/div/div[4]/button[1]').click()
  </code></pre>
  <p>Sometimes I successful sometimes I get error</p>
  <pre><code>ElementClickInterceptedException: element click intercepted: Element &lt;a onclick=&quot;overlay.overlayLogin();&quot; href=&quot;javascript:void(0);&quot; class=&quot;login bold&quot;&gt;...&lt;/a&gt; is not clickable at point (821, 19). Other element would receive the click: &lt;div class=&quot;allow-notifications-popup-wrapper shown&quot;&gt;...&lt;/div&gt;
    (Session info: chrome=84.0.4147.135)
  </code></pre>
  <p>Because a naughty pop-up/alert doesn't always appear.</p>
  <p>How can I write a IF (pop up is there) THEN click it</p>
  <p>OR</p>
  <p>IF pop-not there skip the following two lines?</p>
  <p>Thanks</p>