title: Java WebEngine.executeScript not working for forms or button clicks
body: <p>I am trying to click a button using Java FX's class, WebEngine. I am able to interact with the page to do other things, like read from a text box using the following:</p>
  
  <pre><code>webEngine.executeScript("document.getElementsByName(\"myText\")[0].value = \"Test\";");
  </code></pre>
  
  <p>The above snippet works fine, but when I attempt to execute the below three examples to push a button/submit a form, nothing happens at all.</p>
  
  <pre><code>document.myForm.submit();
  
  document.getElementById(\"myForm\").submit();
  
  document.getElementById("theSubmitButton").click();
  </code></pre>
  
  <p>All three of the three above work when using the Firefox Web Console, but not when I change them to webEngine.executeScript();</p>
  
  <p>Any idea on what would be causing this to not work in the Java webEngine.executeScript() call?</p>
  
  <p>EDIT: Also, I know for a fact that the page is loaded, I have already set up something to wait for the page to load before calling anything.</p>
  
  <p>EDIT2: Here is some more information about the Java call and results. When I call the below line:</p>
  
  <pre><code>System.out.println(webEngine.executeScript("document.getElementById('theSubmitButton').click();"));
  </code></pre>
  
  <p>I get the following results:</p>
  
  <pre><code>undefined
  </code></pre>
  
  <p>When I run this however:</p>
  
  <pre><code>System.out.println(webEngine.executeScript("document.getElementById('theSubmitButton');"));
  </code></pre>
  
  <p>I get this result:</p>
  
  <pre><code>[object HTMLInputElement]
  </code></pre>
  
  <p>So I know the object is present where I think it is, the issue is the .click() call. Again, the below code still works in Firefox's web console as shown below and does everything I need it to do.</p>
  
  <pre><code>document.getElementById('theSubmitButton').click();
  </code></pre>
  
  <p>When I use the .click() function in my java program (using .executeScript()), the button's text changes as I would see in any web browser, but the actual redirection and form submission that I need does not happen. When I use the graphical webEngine browser, it also does not work.</p>
  
  <p>Form submission does work everywhere else (Firefox, Chrome, IE).</p>