Originally, this was a query I had posted in the Zombie group and given that JSDOM is a dependency of Zombie, seems like this is a JSDOM issue.
Essentially, I am using zombie to load a page and click a link that triggers a javascript that does a bunch of stuff and then POSTs the second request. However the issue I have is with the DOM that is getting created (by an older version of JSDOM and the same issue is seen in the latest version as well).
So, I have a form -
<form action="/logon" method="POST" name="logonForm" enctype="application/x-www-form-urlencoded" autocomplete="off">
.
.
</form>
I have a javascript that is loaded with the initial request that has for example the line -
document.logonForm.submit();
This fails because document.logonForm is undefined during the Javascript execution.
Both in zombie and in JSDOM I have a valid DOM element for - document.getElementsByName('logonForm')[0];
I cannot do a request based POST followed by JSDOM, because the post needs values that are dynamically generated by the javascript prior to the submission of the form.
Any suggestions?