title: WebDriver: Change event not firing
body: <p>I have an application that is using KnockoutJS and I'm attempting to write some tests that test a form. If you don't know KnockoutJS, the short story for it is that it provides bindings from my view to my data model. This means that when I type a value in the an input field, my underlying object automatically gets updated with that input fields value. This is done through a change event by default.</p>
  
  <p>The problem I am having is that when my WebDriver test is typing into the field, the change event is not firing so my underlying data model does not have the appropriate values. This causes my form validation to fail when it should not.</p>
  
  <p>I've done everything I could find on the internet to make this work. I've:</p>
  
  <ol>
  <li>sent the tab key</li>
  <li>clicked away from the form field</li>
  <li>send JavaScript code to fire focus and blur events (validation occurs on blur)</li>
  <li>clicked the form field before typing</li>
  <li>set waits just incase it was a timing issue</li>
  <li>changed KnockoutJS to update input field on afterkeydown</li>
  </ol>
  
  <p>None of these have worked for me. </p>
  
  <p>In addition, I have verified that this is not an event bubbling issue as I removed all other events explicitly, leaving just the KnockoutJS change event.</p>
  
  <p>for the solution i'm looking for is one that works for all browser drivers (... at least the main ones e.g. IE, FF, Chrome, Safari) and does not require the use of jQuery.</p>
  
  <p>How do I solve the problem?</p>
  
  <p>Here is the relevant code I'm using to type values into the field:</p>
  
  <pre><code>// find element
  WebElement input = this.element.findElement(By.className("controls"))
                                 .findElement(By.tagName("input"));
  
  // to set focus?
  input.click();
  
  // erase any existing value (because clear does not send any events
  for (int i = 0; i &lt; input.getAttribute("value").length(); i++) {
      input.sendKeys(Keys.BACK_SPACE);
  }
  
  // type in value
  input.sendKeys(text);
  
  // to fire change &amp; blur? (doesnt fire change)
  //input.sendKeys(Keys.TAB);
  
  // to fire change &amp; blur? (doesnt fire change)
  driver.findElement(By.tagName("body")).click();
  </code></pre>