title: how to click on button which is present in a frame using selenium webdriver
body: <pre><code>[image][1]
  </code></pre>
  
  <p>The button present in the frame, i have written code for switch the frame and click on the facebook button but the click operation is not performed, give s my html code please help me out</p>
  
  <p>Html frame </p>
  
  <pre><code>&lt;document&gt;
  &lt;html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;body id="social_login" class="plugin"&gt;
  &lt;!--[if IE]&gt;&lt;div id="ie"&gt;&lt;![endif]--&gt;
  &lt;div id="social_login_frame" class="frame"&gt;
  &lt;div id="content"&gt;
  &lt;div id="providers" class="providers providers_unpaginated"&gt;
  &lt;div id="providers_group_1" class="providers_group"&gt;
  &lt;div class="providers_block" role="application"&gt;
  &lt;div class="providers_row"&gt;
  &lt;div id="provider_facebook" class="provider"&gt;
  &lt;a id="button_facebook" class="button" href="#" rel="nofollow" title="Login with Facebook" role="button" aria-label="Login with Facebook" aria-haspopup="true"&gt;
  &lt;div id="name_facebook" class="name"&gt;Facebook&lt;/div&gt;
  &lt;/div&gt;
  &lt;div id="provider_google" class="provider"&gt;
  &lt;div id="provider_linkedin" class="provider"&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  
  
    [1]: https://i.stack.imgur.com/jXMDe.png
  </code></pre>
  
  <p>Webdriver code </p>
  
  <pre><code>driver.findElement(By.xpath("//*[@id='contentagent']/div[2]/‌​ul/li[2]/a")).click(‌​); 
  Thread.sleep(1000); 
  driver.switchTo().frame(0); 
  Thread.sleep(500); 
  driver.findElement(By.id("button_facebook")).click();
  </code></pre>