Search code examples
imacros

Submit form with iMacros


I know this might seem a lazy question, but I did not find a straight to the point answer yet.

When I type "submit form with imacros" on Google, nothing is clear to me.

And the official iMacros documentation talks about filling forms, but not about submitting them.

I saw that some examples use javascript:

URL GOTO=javascript:window.document.form.submit();

Other examples use CLICK with coordinates.

So, how do you submit forms with iMacros?


Solution

  • The most basic way to submit a form is via the submit button supplied at the page. The easiest way to do so is to record clicking on it (FireFox iMacro addon -> Record tab -> Record , play with record options only if needed). The output will be saved under #Current.iim and will look like this:

    VERSION BUILD=8970419 RECORDER=FX
    TAB T=1
    URL GOTO=http://demo.imacros.net/Automate/TestForm1
    TAG POS=1 TYPE=BUTTON FORM=ACTION:/Automate/FormSubmitConfirm ATTR=TXT:Click<SP>to<SP>order<SP>now
    

    iMacro will use attributes like html type, form action and the text on the button to identify it against others. Once recorded you can start messing around with attributes if you have additional needs.

    Solutions like CLICK or javascript have a tendency to almost never work (for me personally) and are used in more extreme cases where the buttons change names/ids/locations in an unpredictable way.