title: Unable to click button in popup using webdriver
body: <p>I am trying to click a button using selenium webdriver. Working fine with the following XPath</p>
  
  <pre><code>driver.FindElement(By.XPath("html/body/div[36]/div[3]/div/button[1]")).click();
  </code></pre>
  
  <p>it clicks the button fine but if I try to find it using class then it wont click it</p>
  
  <pre><code>driver.FindElement(By.XPath("//div[@class='ui-dialog-buttonset']/button[1]")).click();
  </code></pre>
  
  <p>Any Idea what I am doing wrong. Actual source code is as follows:-</p>
  
  <pre><code>&lt;div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"&gt;
  
      ::before
      &lt;div class="ui-dialog-buttonset"&gt;
          &lt;button class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="button" role="button" aria-disabled="false"&gt;
  
      &lt;span class="ui-button-text"&gt;&lt;/span&gt;
  
  &lt;/button&gt;
  &lt;button class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="button" role="button" aria-disabled="false"&gt;
  
                  &lt;span class="ui-button-text"&gt;&lt;/span&gt;
              &lt;/button&gt;
          &lt;/div&gt;
          ::after
      &lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>