title: Open a webpage and click a particular tab
body: <p>I am trying to open a webpage on button click, go to a particular section, traverse across multiple pages upon next button arrow image click. </p>
  
  <p>I have to extract information from this website. The HTML structure of page is:</p>
  
  <pre><code>&lt;div&gt;
   &lt;div&gt;
    &lt;table class="A"&gt;
     &lt;tbody&gt;
      &lt;tr&gt;
       &lt;td class="B"&gt;
        &lt;div class="C"&gt;
         &lt;ul id="D" class="E"&gt;
          &lt;li id="W" class="T U"&gt;&lt;/li&gt;
          &lt;li id="X" class="T U "&gt;&lt;/li&gt;
          &lt;li id="Y" class="T U"&gt;&lt;span class="SPANCLASSNAME"&gt;HEADER TAB CAPTION&lt;/span&gt;&lt;/li&gt;
          &lt;li id="Z" class="T U"&gt;&lt;/li&gt;
         &lt;/ul&gt;
        &lt;/div&gt;
       &lt;/td&gt;
      &lt;/tr&gt;
     &lt;/tbody&gt;
    &lt;/table&gt;  
   &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>All the data I need could be under any <code>li</code> element. Here I have it under the third <code>li</code> element.</p>
  
  <pre><code>Private Sub Button_Click()
      Dim IE As Object    
      Set IE = CreateObject("InternetExplorer.Application")
      IE.Visible = True
      IE.Navigate "URL"
  
      Do
          DoEvents
      Loop Until IE.ReadyState = 4
  
      Set AllSpanElements = IE.Document.getElementsByClassName("SPANCLASSNAME")
      For Each span In AllSpanElements
          MsgBox span.innerText
          If span.innerText = "HEADER TAB CAPTION" Then
              MsgBox span.innerText
                  span.Click  'DOES NOT WORK. WHAT SHOULD BE THE CODE HERE?
              Exit For
          End If
      Next    
      MsgBox "Operation Completed"
  End Sub
  </code></pre>
  
  <p>I am able to open the webpage and the MsgBox displays the text from all the <code>li</code> elements and flow reaches till Operation Completed but the click action does not happen.  </p>
  
  <p>What code would send the click action to IE?</p>