Using win32com for web automation
calfdog at yahoo.com
calfdog at yahoo.com
Mon Aug 1 16:29:22 EDT 2005
ina wrote:
> Look up pamie it should do all the work you need. If it dosn't I can
> send you ishyBrowser but pamie has more comunity support.
FYI
#Imports
from win32com.client import Dispatch
from time import sleep
# Create a new browser object
ie = Dispatch('InternetExplorer.Application')
# Make the browser visible
ie.Visible = 1
# Navigate to the site
ie.Navigate("http://ispds-sepsr.prv:7500/cs/welcome.jsp")
# wait for the document to fully load
while ie.ReadyState != 4:
sleep(1)
doc = ie.Document
while doc.readyState != "complete":
sleep(1)
# set the textbox value for name to 'some_string'
doc.loginForm.name.value = 'username'
# set the textbox value for password to 'some_string'
doc.loginForm.password.value = 'password'
# submit the form
doc.loginForm.submit()
Added some comments to make it clearer
You will now need another wait for the next document you load
You can put the wait into a wait method
or you could try PAMIE
http://pamie.sourceforge.net
Hope it helps
Rob
More information about the Python-list
mailing list