title: Could not click a button - Java Selenium Webdriver
body: <p>I am trying to click a "Save" button in a pop window using Java Selenium Webdriver, however it throws an exception </p>
  
  <blockquote>
    <p>Message:Element is not currently visible and so may not be interacted with Command duration</p>
  </blockquote>
  
  <p>I am able to see the "Save" button active in my pop window. I could not figure out the reason why it throws an exception.</p>
  
  <p>HTML CODE for the Save button that I am trying to click,</p>
  
  <pre><code>&lt;/div&gt;
  &lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  &lt;hr&gt;
  &lt;button class="btn btn-primary" style="margin-left: 10px" ng-click="saveData()" data-dismiss="modal" type="button"&gt;Save&lt;/button&gt;
  &lt;button id="buttonmodalcancel" class="btn btn-default" ng-click="cancel()" type="button"&gt;Cancel&lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>firepath: html/body/div[6]/div/div/div[2]/div/div/button[1].</p>
  
  <p>I did not use the XPath as the contents after html/body/div, keeps changing. </p>
  
  <p>Java code that I used:</p>
  
  <pre><code>driver().manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
  driver().findElementByXPath("//*[contains(text(), 'Save')]").click();
  </code></pre>