filling forms automatically generated using javascript

David Golightly davigoli at gmail.com
Wed Nov 22 00:17:59 EST 2006


John wrote:
> Is there an automatic way of filling forms that have been generated
> using javascript?
> I tried to use python+mechanize but am having trouble with javascript
> forms.
>

Yes, it depends on what you're trying to do of course, but usually you
just set the input element's "value" property.  (The exception here is
<input type="file">, where the value property is read-only for security
reasons.)  This can be done even without javascript; just set the value
attribute in the HTML code if you want default values.  It shouldn't
matter what your backend language is.

> This is the way the form is created:
>
> <script
> src="/WebResource.axd?d=uz45jgd0NVyzsVJV_sZDrjxBvvX2yHd3hs2IGgfXLN3pPD65PTl8Gec4qFJa35leX_j-S-HQNzQg1sDk82eQYafpf0w9zI7HaoMUnMjb9ihQ96Tf0qvT-Air__85j5db0&t=632972974720000000"
> type="text/javascript"></script>

We really can't do anything with that.  The url is useless because it's
not absolute, so we can't look at your code.  Please post a working
link if you want help.

Thanks,

David




More information about the Python-list mailing list