Subj : Help regarding javascript execution To : netscape.public.mozilla.jseng From : Shreekanth Date : Wed May 19 2004 09:54 pm Hi all,         I am trying to write a program which would automatically  submit forms. While I have the heuristics implemented for getting the correct choice from the given list of huge choices(list, dropdowns, text boxes etc. ), I am stuck at some point.         The point where I am stuck is the place where the javascript methods get called when you click submit buttons or before the form gets submitted or on similar such situations.         I have been trying to use Spidermonkey. But somehow I am not able to give it the context of the current document. That is, it can't execute 'document.forms[0].submit()' calls.         I don't care much about the prompt(), alert() calls which can't do without a UI. I want to run this without a UI.         I have gone through the archives of news groups. Though  many had the similar problems, but I couldn't find an apt solution for this.         Have been digging into mozilla source. Found a couple of places like nsJSEnvironment.cpp and nsDOMClassInfo.cpp where the context could possibly have been set. But I couldn't yet find the exact way in which mozilla tells spidermonkey - 'look here is the document for you, resolve any document.x references to this'.         Brendan Eich, Boris Zbarsky gave me a little insight. Am posting this  to this news group since I'm sure there are many who have solved this problem successfully or know how to solve this.         Please post any pointers which would help solving this problem. Thanks Shreekanth .