How to fill a textArea in an online form automatically using Python?
Question: I am wondering how I can fill an online form automatically. I have researched
it and it tuned out that, one can uses Python ( I am more interested to know
how to do it with Python because it is a scripting language I know) but
documentation about it is not very good. This is what I found:

[Fill form values in a web page via a Python script (not
testing)](http://stackoverflow.com/questions/1555234/fill-form-values-in-a-
web-page-via-a-python-script-not-testing)

Even the "mechanize" package itself does not have enough documentation:

<http://wwwsearch.sourceforge.net/mechanize/>

More specifically, I want to fill the TextArea in this page (Addresses):
<http://stevemorse.org/jcal/latlonbatch.html?direction=forward>

so I don't know what I should look for? Should I look for "id" of the the
textArea? ?It doesn't look like that it has "id" (or I am very naive!). How I
can "select_form"?

Python, web gurus, please help.

Thanks


Answer: See if my answer to the other question you linked helps:
<http://stackoverflow.com/a/5685569/711017>

**EDIT:** Here is the explicit code for your example. Now, I don't have
mechanize installed right now, so I haven't been able to check the code. No
online IDE's I checked have it either. But even if it doesn't work, toy around
with it, and you should eventually get there:

    
    
    import re
    from mechanize import Browser
    br = Browser()
    br.open("http://stevemorse.org/jcal/latlonbatch.html?direction=forward")
    br.select_form(name="display")
    br["locations"] = ["Hollywood and Vine, Hollywood CA"]
    response = br.submit()
    print response.read()
    

Explanation: `br` emulates a browser that opens your url and selects the
desired form. It's called _display_ in the website. The textarea to enter the
address is called _locations_ , into which I fill in the address, then submit
the form. Whatever the server returns is the string `response.read()`, in
which you should find your Lat-Longs somewhere. Install mechanize and check it
out.

