MS document object model:
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/objects/obj_document.asp
and
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/webbrowser/reference/ifaces/IWebBrowser2/IWebBrowser2.asp
wanna submit stuff from a form automatically? You have to dig in a little deeper into the html source for that, find the script name and the variables being passed to it, and do it through the urllib and urllib2 modules of python, or you can use IEs COM interfaces.
doc = ie.Document
doc.forms(0).Account.value = "987654321" # Referenced as the first (0 based count) form on the page.
sleep(0.5) # Otherwise it seems to run too fast and get confused :-(
doc.frmLogin.Password.value = "some_password" #Referenced by the form's name in the HTML.
sleep(0.5)
doc.forms(0).submit() # Sends the info.
sleep(1)
You can check if it's finished processing by checking if
ie.ReadyState == 4 and
doc.readyState == "complete"
and here's how to get IE to save a webpage to a file with python
import win32com.client,time,string
# Get the browser object
ie = win32com.client.DispatchEx("InternetExplorer.Application")
ie.Visible = 0
ie.Navigate("http://www.google.com")
time.sleep(5)
text = ie.Document.body.innerHTML
text = unicode(text)
text = text.encode('ascii','ignore')
filename = "c:/test.html"
output_file = open(filename,'w')
output_file.write(text)
output_file.close()
ie.close()
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/objects/obj_document.asp
and
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/webbrowser/reference/ifaces/IWebBrowser2/IWebBrowser2.asp
wanna submit stuff from a form automatically? You have to dig in a little deeper into the html source for that, find the script name and the variables being passed to it, and do it through the urllib and urllib2 modules of python, or you can use IEs COM interfaces.
doc = ie.Document
doc.forms(0).Account.value = "987654321" # Referenced as the first (0 based count) form on the page.
sleep(0.5) # Otherwise it seems to run too fast and get confused :-(
doc.frmLogin.Password.value = "some_password" #Referenced by the form's name in the HTML.
sleep(0.5)
doc.forms(0).submit() # Sends the info.
sleep(1)
You can check if it's finished processing by checking if
ie.ReadyState == 4 and
doc.readyState == "complete"
and here's how to get IE to save a webpage to a file with python
import win32com.client,time,string
# Get the browser object
ie = win32com.client.DispatchEx("InternetExplorer.Application")
ie.Visible = 0
ie.Navigate("http://www.google.com")
time.sleep(5)
text = ie.Document.body.innerHTML
text = unicode(text)
text = text.encode('ascii','ignore')
filename = "c:/test.html"
output_file = open(filename,'w')
output_file.write(text)
output_file.close()
ie.close()
