title: Unable to click on element - Selenium WebDriver
body: <p>I'm trying to click on a Checkout Button. This is how it looks like :</p>
  
  <p><a href="https://i.stack.imgur.com/TiMEO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TiMEO.png" alt="enter image description here"></a></p>
  
  <p>And HTML snippet for the same :</p>
  
  <pre><code>&lt;div id="buy-button-next"&gt;
     &lt;span data-reactroot=""&gt;
        &lt;div data-cid="buy-button--enabled" style="align-items: center; border-style: solid; border-width: 0px; box-sizing: border-box; display: flex; flex-basis: auto; flex-direction: column; flex-shrink: 0; margin: 0px; padding: 0px; position: relative; min-height: 0px; min-width: 0px;"&gt;
           &lt;div style="align-items: stretch; border-style: solid; border-width: 0px; box-sizing: border-box; display: flex; flex-basis: auto; flex-direction: column; flex-shrink: 0; margin: 0px; padding: 0px; position: relative; min-height: 0px; min-width: 340px;"&gt;
              &lt;button data-cid="button.buy_button" style="padding: 0px; margin: 0px; background-color: rgba(255, 255, 255, 0); border: none; cursor: pointer; outline: 0px; -webkit-tap-highlight-color: rgba(255, 255, 255, 0);"&gt;
                 &lt;div style="align-items: stretch; border-style: solid; border-width: 1px; box-sizing: border-box; display: flex; flex-basis: auto; flex-direction: column; flex-shrink: 0; margin: 0px; padding: 4px; position: relative; min-height: 0px; min-width: 0px; background-color: rgb(52, 52, 52); border-color: rgba(255, 255, 255, 0); border-radius: 3px; height: 50px; transition: background-color 0.2s ease, border-color 0.2s ease;"&gt;
                    &lt;div style="align-items: stretch; border-style: solid; border-width: 0px; box-sizing: border-box; display: flex; flex-basis: auto; flex-direction: column; flex-shrink: 0; margin: 0px; padding: 0px; position: absolute; min-height: 0px; min-width: 0px; background-color: rgba(255, 255, 255, 0); border-radius: 3px; bottom: -1px; left: -1px; opacity: 1; right: -1px; top: -1px; transition: background-color 0.2s ease, opacity 0.2s ease; z-index: 1;"&gt;&lt;/div&gt;
                    &lt;div style="align-items: center; border-style: solid; border-width: 0px; box-sizing: border-box; display: flex; flex-basis: auto; flex-direction: column; flex-shrink: 0; margin: 0px; padding: 0px 21px; position: relative; min-height: 0px; min-width: 0px; background-color: rgba(255, 255, 255, 0); border-radius: 3px; height: 100%; justify-content: center; transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease; z-index: 2;"&gt;
                       &lt;div style="align-items: stretch; border-style: solid; border-width: 0px; box-sizing: border-box; display: flex; flex-basis: auto; flex-direction: column; flex-shrink: 0; margin: 0px; padding: 0px; position: absolute; min-height: 0px; min-width: 0px; align-self: center; top: 50%; transform: translateY(-2px);"&gt;&lt;/div&gt;
                       &lt;span style="max-width: 100%; color: rgb(255, 255, 255); font-family: &amp;quot;Klarna Sans&amp;quot;, Helvetica, Arial, sans-serif; font-weight: 700; font-size: 16px; opacity: 1; transition: color 0.2s ease; visibility: visible; -webkit-font-smoothing: antialiased; text-rendering: geometricPrecision; text-size-adjust: none;"&gt;Place Order&lt;/span&gt;
                    &lt;/div&gt;
                 &lt;/div&gt;
              &lt;/button&gt;
           &lt;/div&gt;
           &lt;div style="align-items: stretch; border-style: solid; border-width: 0px; box-sizing: border-box; display: flex; flex-basis: auto; flex-direction: column; flex-shrink: 0; min-height: 0px; min-width: 0px; background-color: rgba(255, 255, 255, 0); width: 100%; height: 30px;"&gt;&lt;/div&gt;
        &lt;/div&gt;
     &lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>All content loads in an iFrame, So I'm switching in iFrame as well.</p>
  
  <pre><code>driver.switchTo().frame("klarna-checkout-iframe");
  </code></pre>
  
  <p>but the button have weird html.</p>
  
  <p>Code trial I did:</p>
  
  <pre><code>css=button[data-cid='button.buy_button'] span
  
  xpath=//div/span[contains(text(),'Place Order')]
  </code></pre>
  
  <p>I'm getting Timeout exception while waiting for presence of this element. </p>
  
  <blockquote>
    <p>Timed out after 35 seconds waiting for presence of element located by:
    By.cssSelector: button[data-cid='button.buy_button'] span</p>
  </blockquote>