HTML DOM parser?
calfdog at yahoo.com
calfdog at yahoo.com
Sat Aug 2 01:12:22 EDT 2003
Here is a quick example of using automation with IE
# This is a sample of automating IE using Python.
from win32com.client import Dispatch
import time
# wait for IE.
def wait(ie):
"Given an IE object, wait until the object is ready for input."
while ie.Busy:
time.sleep(.1)
# create the browser window and make it visible
ie = Dispatch('InternetExplorer.Application')
ie.Visible = 1
ie.Navigate('http://samie.sf.net/simpleform.html')
wait(ie)
# Some text to add into the text edit box
settext1= 'TEST'
settext1 = '30'
# There is only one form here
form = ie.Document.forms[0]
# Loop thru the elements and count the elements
count = 0
while count < form.elements.length:
elements = form.elements[count]
# Debug - check variables
print elements.attributes
print "---------------------"
print elements.type
print "---------------------"
print elements.name
# Debug - check variables
print settext1
print settext2
# Set text in the text edit box
elements.value = settext1
elements.value = settext2
count +=1
# Submit the form
form.submit()
wait(ie)
More information about the Python-list
mailing list