Creating multiple instances of IE COM browser objects.

The following code allows you to create more than one IE browser session and interact with each different one.

# Use the makepy utility for the "Microsoft Internet Controls (1.1)"

# object library to get early binding.
from win32com.client import Dispatch
import pythoncom

ie1 = pythoncom.CoCreateInstance("InternetExplorer.Application", None,\
pythoncom.CLSCTX_SERVER,
pythoncom.IID_IDispatch)
ie1 = Dispatch(ie1)

ie2 = pythoncom.CoCreateInstance("InternetExplorer.Application", None,\
pythoncom.CLSCTX_SERVER,
pythoncom.IID_IDispatch)
ie2 = Dispatch(ie2)

# and so on.....

Leave a Reply

Your email address will not be published. Required fields are marked *