title: Close popup if existing on the web page
body: <p>I am trying to scrape the data from a website. The web page may pop up a security dialog box before the login page.</p>
  <p>I tried to close the dialog box with</p>
  <pre><code>Dr.FindElementByCss(&quot;.pa.pa-times&quot;).Click
  </code></pre>
  <p>In some cases it doesn't show the popup dialog box then my above code is throwing an error.</p>
  <p>If the popup dialog box does not exist it should continue with the next line of code.</p>
  <pre class="lang-vb prettyprint-override"><code>Sub abc()
  
      Dim Dr As New Selenium.EdgeDriver
      Dr.Get &quot;url.com&quot;
  
      Dim Dia As Object
      Set Dia = Dr.FindElementByCss(&quot;.pa.pa-times&quot;)
      If IsObject(Dia) Then
          Dr.FindElementByCss(&quot;.pa.pa-times&quot;).Click
      Else
      End If
      '------------------------
      other line of code continues
      '------------------------ 
  
  End Sub
  </code></pre>
  <p>Html code for your reference.</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;div class="row announcements-row"&gt;
              &lt;div class="col-lg-8 right-col"&gt;
                  &lt;div class="modal-content"&gt;
                      &lt;div class="modal-header"&gt;
                          &lt;h2 class="modal-title"&gt;
                              Password Security Improvement
                              &lt;span class="close-modal" onclick="loginAnnouncement()"&gt;&lt;span&gt;&lt;i class="pa pa-times"&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;
                          &lt;/h2&gt;
                      &lt;/div&gt;
                      &lt;div class="modal-body"&gt;
                          ****abc****. &lt;br&gt;
                              &lt;ul&gt;
                              &lt;li&gt;Can't login? &lt;/li&gt;
                              &lt;/ul&gt;
  
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>