title: How to switch to a different <div> and locate an element using WebEelement
body: <p>My page has the following source code:</p>
  
  <pre><code>&lt;body&gt;
      &lt;div id="nsm-header" class="ericssonApplicationBar"&gt;
      &lt;div id="nsm-body"&gt;
      &lt;div id="nsm-footer"&gt;
  &lt;body&gt;
  </code></pre>
  
  <p>I need to locate an element in <strong>"nsm-body"</strong> and when I click on it, a new window/pop-up opens and there will some additional tags apart from above three. So now page source looks like this:</p>
  
  <pre><code>  &lt;body&gt;
         &lt;div id="nsm-header" class="ericssonApplicationBar"&gt;
         &lt;div id="nsm-body"&gt;
         &lt;div id="nsm-footer"&gt;
         &lt;div id="content_0:installNE_shade" class="rf-pp-shade" style="z-index:10001;"&gt;
         &lt;div id="content_0:installNE_container" class="rf-pp-cntr e-dialog " 
    &lt;body&gt;
  </code></pre>
  
  <p>Now my element is present in a div with ID <code>content_0:installNE_container</code>. When I say <code>findElement</code> I get a StaleElement exception.</p>
  
  <p>Now how do I avoid this and access the element? I tried fetching <strong>windowHandles</strong> and then switching to the current window but nothing happened. I also tried with <code>switchTo.defaultContent</code>, but still no use. </p>
  
  <p>Please help me out.</p>