title: How to switch into <DIV> inside another <DIV>s in selenium
body: <p>I am trying to click on a button which is inside nested DIVs.
   Below is the html</p>
  
  <pre><code>&lt;div class="chat-message-container ngi bot" chat-msg-id="EzPtItD3exi2lTGS3SQkV0-h|0000016" chat-msg-text="What is the intended purpose of your investment"&gt;
              &lt;div class="message-bubble"&gt;
  
                  &lt;div class="message-text"&gt;&lt;p&gt;What is the intended purpose of your investment&lt;/p&gt;
                  &lt;/div&gt;
                  &gt;
              &lt;/div&gt;
              &lt;div class="attachment-container"&gt;
          &lt;div id="0attachment" style="display: block" class="attachment"&gt;
              &lt;div class="attachment-info"&gt;
                  &lt;div class="attachment-title"&gt;&lt;/div&gt;
                  &lt;p class="attachment-subtitle-1"&gt;&lt;/p&gt;
                  &lt;p class="attachment-subtitle-2"&gt;&lt;/p&gt;
                  &lt;div class="carousel-counter-container"&gt;
                      &lt;button type="button" id="0prev" class="carousel-btn-ngi" data-atura-carousel="prev"&gt;&amp;lt;&lt;/button&gt;
                      &lt;p class="carousel-counter" }"=""&gt;1/1&lt;/p&gt;
                      &lt;button type="button" id="0next" class="carousel-btn-ngi" data-atura-carousel="next"&gt;&amp;gt;&lt;/button&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
  
              &lt;div class="action-button-container"&gt;&lt;a href="0 - 3 years" class="link-as-button quick-reply" data-instant-message-reply-ngi="" data-button-display-value="0 - 3 years"&gt;0 - 3 years&lt;/a&gt;&lt;a href="3 - 5 years" class="link-as-button quick-reply" data-instant-message-reply-ngi="" data-button-display-value="3 - 5 years"&gt;3 - 5 years&lt;/a&gt;&lt;a href="over 5 years" class="link-as-button quick-reply" data-instant-message-reply-ngi="" data-button-display-value="over 5 years"&gt;over 5 years&lt;/a&gt;
              &lt;/div&gt;
          &lt;/div&gt;&lt;/div&gt;
          &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>I need to click on button 0 - 3 years</p>
  
  <p>I have tried to click the elemet using xpath as below
  driver.findElement(By.xpath("//*[@id='0attachment']/div[2]/a[1]")).click();</p>
  
  <p>it did not work. I think it is because of the nested structure. I read about the switch method. But i dont think that can be used to switch inside another DIV</p>
  
  <p>Kindly help</p>