imitating user input

calfdog at yahoo.com calfdog at yahoo.com
Tue Apr 20 14:40:57 EDT 2004


Greg,

There are lots of ways to do this. Pamie is just one method.
basically you want to set the value of a two textboxes and submit the
form.

If you have an instance of the browse you can access it's methods and
attributes.

In Python you could do it this way:  

#Instantiate a new instance of the IE browser:
ieBrowser = DispatchEx('InternetExplorer.Application')

Now you have access to the textboxes and it's buttons
Since you have and instance of the browser ieBrowser you can begin:

For example a simple login page with username textbox, password
textbox and submit button.

ieBrowser.Document.forms[0].elements.all[username].value =
"YourUsername"
ieBrowser.Document.forms[0].elements.all[password ].value =
"YourPassword"
ieBrowser.Document.forms[0].elements.all[SubmitButtonName].form.submit()

You can get the actual names for your username, password and
SubmitButtonName from viewing the source of the Webpage and doing a
find on the word "input"

You can do the above in Perl VB ruby etc.. although the syntax may be
a little different.

Hope this helps.

Enjoy

RLM
Pamie creator




For more information:
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/dhtml_reference_entry.asp



More information about the Python-list mailing list