Elliot Temple <[EMAIL PROTECTED]> wrote: > >How do I make Python press a button on a webpage? I looked at >urllib, but I only see how to open a URL with that. I searched >google but no luck. > >For example, google has a button <input type=submit value="Google >Search" name=btnG> how would i make a script to press that button? > >Just for fun, is there any way to do the equivalent of typing into a >text field like the google search field before hitting the button? >(I don't actually need to do this.)
Both things are done the same way. The Google Search button is a field named "btnG" with the value "Google Search". The query field itself is named "q". Then, if you look at the HTML, you'll see that this is wrapped in a <form> with the action "/search". So, all you need to do, then, is to encode all this in a URL: http://www.google.com/search?btnG=Google%20Search&q=python%20urllib This only works because the Google "search" page accepts parameters using the "GET" method, which is what you get when you send parameters in the URL. Many forms only accept parameters using the "POST" method, in which you send the encoded parameters as the body of the HTTP request. You probably need to do some reading on HTTP, and the GET and POST methods of transmitting parameters. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list