How to get results after submit form with PhantomJS?
<p>I'm trying to get results from a simple form using PhantomJS. I'm using jQuery but don't work. I have this HTML:</p>

<pre class="lang-php prettyprint-override"><code>&lt;!doctype html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;PhantomJS!&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form method="post" id="frm"&gt;
&lt;input type="text" name="nombre" id="nombre" /&gt;
&lt;input type="submit" value="Publicar" id="btn-submit" /&gt;
&lt;/form&gt;

Your name is &lt;span id="nombrez"&gt;&lt;?php if (isset($_POST['nombre'])) { echo $_POST['nombre'];} ?&gt;&lt;/span&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>And this Javascript code:</p>

<pre class="lang-js prettyprint-override"><code>var page = require('webpage').create();
page.open('http://localhost/phantom/', function() {
  page.includeJs("https://code.jquery.com/jquery-3.1.1.slim.js", function() {
    page.evaluate(function() {

      $('#nombre').val('Fabian');
    document.forms[0].submit();
   });

    page.onLoadFinished = function(){

    console.log($("#nombrez").html());
    phantom.exit();

    };  


  });
});
</code></pre>