title: why do I have to click twice to a submit input using selenium
body: <p><strong>ENV</strong></p>
  
  <p>chrome 32 webdriver2.8</p>
  
  <p>I am using selenium(java) to click a submit input. But I need to click twice to active the submit operation.</p>
  
  <p>The input code:</p>
  
  <pre><code>&lt;input type="submit" disabled="disabled" id="id_submit" name="submit" class="btn-txt" value="OK"&gt;
  </code></pre>
  
  <p><strong>NOT WORK</strong> selenium code:</p>
  
  <pre><code>if(submitButton.isEnabled()) {
      new Actions(driver).moveToElement(submitButton).perform();
      submitButton.click(); // this sentence is executed.
  }
  </code></pre>
  
  <p><strong>WORKS</strong></p>
  
  <pre><code>submitButton.click();
  submitButton.click();
  </code></pre>
  
  <p>Well, the first click function seems to make the button get focus, and the second click function active submit operation. When I use moveToElement to focus the button first, the click not work either. I can ensure that the button is enabled. I want to use selenium to click button and I dont want to do click twice. What should I do? Any ideas? Thanks.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p><strong>WORKS EITHER</strong></p>
  
  <pre><code>JavascriptExecutor jse = (JavascriptExecutor) driver;
  jse.executeScript("document.getElementById('id_submit').focus();");
  jse.executeScript("document.getElementById('id_submit').click();");
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Imagine that I want to input a string, say "abcdef123456". Then send_keys is executed. It looks like
  <img src="https://i.stack.imgur.com/TiOhu.jpg" alt="enter image description here"> and submit button is enabled. After click the submit button at the first time. It looks like<img src="https://i.stack.imgur.com/bS3iT.jpg" alt="enter image description here"> and submit button get focus. After click the submit button at the second time, the form is submited and page is redirected. I am confusing about the first <em>click</em>.</p>