I am familiar with PhantomJS. But I canβt get one. I have a page with a simple form:
<FORM action="save.php" enctype="multipart/form-data" method="GET" onSubmit="return doSubmit();"> <INPUT name="test_data" type="text"> <INPUT name="Submit" type="submit" value="Submit"> </FORM>
and save.php just writes the value of test_data p>
so i do this:
page.evaluate(function() { document.forms[0].test_data.value="555"; doSubmit(); });
When rendering the page, I see that the text field has a value of 555, but the form is not submitted, and save.php does not record the value of test_data. So doSubmit() not executing, right? doSubmit() is a simple validation step, and it is assumed that the sender will load the next page.
So the question is: how can I execute javascript code on a page using PhantomJS?
source share