473,597 Members | 2,198 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

separate IE instances?

I need to create a set of IE instances that have different sets of
session cookies. I thought that using the win32com.Dispat chEx function
would do this, but it doesn't seem to. In other words

ie1 = win32com.Dispat chEx("InternetE xplorer.Applica tion")
ie2 = win32com.Dispat chEx("InternetE xplorer.Applica tion")

gives me two IE windows, but only one IEXPLORE process in Task Manager.
And if I login to a site that uses session cookies to track sessions
using ie1, when I move ie2 to the same site, ie2 is already logged in.

Any help appreciated.

-Chris

Jul 19 '05 #1
12 2581
"Chris Curvey" <cc*****@gmail. com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
I need to create a set of IE instances that have different sets of
session cookies. I thought that using the win32com.Dispat chEx function
would do this, but it doesn't seem to. In other words

ie1 = win32com.Dispat chEx("InternetE xplorer.Applica tion")
ie2 = win32com.Dispat chEx("InternetE xplorer.Applica tion")

gives me two IE windows, but only one IEXPLORE process in Task Manager.
And if I login to a site that uses session cookies to track sessions
using ie1, when I move ie2 to the same site, ie2 is already logged in.

Any help appreciated.

-Chris


from win32com.client import Dispatch

ie1 = pythoncom.CoCre ateInstance("In ternetExplorer. Application", None,\
pythoncom.CLSCT X_SERVER,
pythoncom.IID_I Dispatch)
ie1 = Dispatch(ie1)
ie2 = pythoncom.CoCre ateInstance("In ternetExplorer. Application", None,\
pythoncom.CLSCT X_SERVER,
pythoncom.IID_I Dispatch)
ie2 = Dispatch(ie2)
..
..
..

Jul 19 '05 #2
Bummer. No change at all. (In fact, I can't even call Navigate()
without throwing an error). I'm on win2k, if that makes any difference.

Jul 19 '05 #3
Chris Curvey wrote:
Bummer. No change at all. (In fact, I can't even call Navigate()
without throwing an error). I'm on win2k, if that makes any difference.

I could be way off, but isn't windows one of those OS's that doesn't
allow you to have two instances of IEXPORE.EXE running IOW the OS is
preventing you from running two instances of this executable. Someone
with a lot more knowledge of windows internals will I'm sure come along
and correct me ;-)

Mart

Jul 19 '05 #4
I would have given up on this a long time ago, but I can create two
IEXPLORE processes simultaneously (and get the behavior I want) by just
manually launching them from the Start menu. (Of course, that doesn't
mean that I can launch them programmaticall y, but I'm hoping that
someone can give me a definitive answer.)

Jul 19 '05 #5
"Chris Curvey" <cc*****@gmail. com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
I would have given up on this a long time ago, but I can create two
IEXPLORE processes simultaneously (and get the behavior I want) by just
manually launching them from the Start menu. (Of course, that doesn't
mean that I can launch them programmaticall y, but I'm hoping that
someone can give me a definitive answer.)


Right, I hadn't quite understood your problem when I posted my reply. The code
posted does work and allow navigation, etc. but you do have the problem with it
sharing the same session cookies (I'm also on Win2k). And to answer Martin, you
can definitely create as many iexplore.exe instances as you like in Windows.

How to get Python to launch several instances with COM... not sure, although I'm
99% certain it is doable. I'll hunt around and see if I can find a solution
which I'll post back.

J
Jul 19 '05 #6
> "Chris Curvey" <cc*****@gmail. com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
I would have given up on this a long time ago, but I can create two
IEXPLORE processes simultaneously (and get the behavior I want) by just
manually launching them from the Start menu. (Of course, that doesn't
mean that I can launch them programmaticall y, but I'm hoping that
someone can give me a definitive answer.)

"J Correia" <co************ ****@hotmail.co m> wrote in message
news:LYlpe.3895 6$HI.25521@edtn ps84... Right, I hadn't quite understood your problem when I posted my reply. The code posted does work and allow navigation, etc. but you do have the problem with it sharing the same session cookies (I'm also on Win2k). And to answer Martin, you can definitely create as many iexplore.exe instances as you like in Windows.

How to get Python to launch several instances with COM... not sure, although I'm 99% certain it is doable. I'll hunt around and see if I can find a solution
which I'll post back.


A very quick and very, very dirty method which might work is to start up
the instances as follows:
import win32api
a = win32api.ShellE xecute(0,None," iexplore.exe",N one,None,1)
b = win32api.ShellE xecute(0,None," iexplore.exe",N one,None,1)
This creates the 2 instances of iexplore.exe in Windows you're looking for.

Then use code like this to attach to the already running instances:
http://aspn.activestate.com/ASPN/Coo.../Recipe/269345

Haven't tried it because I'm certain there's a much more elegant solution, but
depending on how quickly you need to get going it might be a possible short term
work around until someone posts the better way. Perhaps you can also post some
more info on what you're actually trying to achieve... make it easier for
someone to
help or even suggest alternatives.

JC

Jul 19 '05 #7
thanks for all the help. I'll give the ShellExecute() approach a try
in the morning.

The short version of what I'm trying to do is....

Have my website login to a 3rd party website on behalf of my customer,
fill out a form, and submit it. I'm just using CGI to keep things
simple, but overlapping requests from different customers are the
problem. The 3rd party site uses a lot of javascript, so mechanize
isn't going to work. I could use some kind of locking mechanism and
"single-thread" access to IE, but that won't scale. I guess the next
approach would be to queue the requests and have a pool of worker
processes (running as different users) process the requests and report
back.

Jul 19 '05 #8
>Chris Curvey" <cc*****@gmail. com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. .
thanks for all the help. I'll give the ShellExecute() approach a try
in the morning.

The short version of what I'm trying to do is....

Have my website login to a 3rd party website on behalf of my customer,
fill out a form, and submit it. I'm just using CGI to keep things
simple, but overlapping requests from different customers are the
problem. The 3rd party site uses a lot of javascript, so mechanize
isn't going to work. I could use some kind of locking mechanism and
"single-thread" access to IE, but that won't scale. I guess the next
approach would be to queue the requests and have a pool of worker
processes (running as different users) process the requests and report
back.


You might have a specific reason for using COM, but if not, have you
considered using the python urllib or urllib2 modules instead?
It should overcome the session cookie / overlapping request issues i think.
Jul 19 '05 #9
Here is quick and dirty example of what jc talked about.

import win32api
from win32com.client import Dispatch

a = win32api.ShellE xecute(0,None," iexplore.exe",N one,None,1)
internetExplore rClassIdentity= '{9BA05972-F6A8-11CF-A442-00A0C90A8F39}'
hwnds = Dispatch(intern etExplorerClass Identity)
ieObj = hwnds[1]
ieObj.Navigate( "http://www.google.com/search?hl=en&lr =&q=python")

Jul 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1836
by: Michael Williams | last post by:
Hi, I am trying to understand the performance implications of running a number of separate ActiveXexe processes as opposed to a single ActiveXexe with multiple threads on a Windows 2000 server. I have been told that Windows does not allocate a fixed memory space to its processes, so they are always paged off to disk when inactive. However, all the threads in a single process operate within the same memory space, so are relatively...
4
3681
by: Chad Myers | last post by:
I'm instrumenting my app with a few performance counters and I'd like to ask you all for some advice on how to handle performance counter instances. I have a class library that is a base library for most of our ..NET applications. It provides configuration, logging, exception management/publishing, data access, etc. I have my counters, but I'm curious how I should handle instances. Right now, the instance name is exename-procid like...
2
1042
by: Ravikanth[MVP] | last post by:
Hi Yes 1.0 and 1.1 will create two seperate processes on server. Ravikanth >-----Original Message----- >Do installations and running instances of applications
2
1279
by: ZaX | last post by:
Good day folks, I'm working with a third-party transactionnal SDK, packaged into a few DLL. In a particular scenario, I need to have two sessions opened on the infrastructure I access thru the SDK, and I need programmatical control over the two sessions, so I can make changes in one session depending on the information I receive from the second session and so on. However, according to the third-party SDK support staff, a flaw in their
48
3841
by: phillip.s.powell | last post by:
MySQL 3.23.58 - 4.0.17 (yep, several database server instances, don't ask) I have database Spring with table Students I have database Summer with table Students I am tasked to produce a query of all students in both tables with no duplicates. No clue whatsoever.
62
4399
by: robert | last post by:
I'd like to use multiple CPU cores for selected time consuming Python computations (incl. numpy/scipy) in a frictionless manner. Interprocess communication is tedious and out of question, so I thought about simply using a more Python interpreter instances (Py_NewInterpreter) with extra GIL in the same process. I expect to be able to directly push around Python Object-Trees between the 2 (or more) interpreters by doing some careful locking. ...
12
3102
by: titan nyquist | last post by:
I have a class with data and methods that use it. Everything is contained perfectly THE PROBLEM: A separate thread has to call a method in the current instantiation of this class. There is only ever ONE instantiation of this class, and this outside method in a separate thread has to access it. How do i do this?
9
5052
by: koschwitz | last post by:
Hi, I hope you guys can help me make this simple application work. I'm trying to create a form displaying 3 circles, which independently change colors 3 times after a random time period has passed. I'm struggling with making the delegate/invoke thing work, as I know GUI objects aren't thread-safe. I don't quite understand the concept I'm supposed to use to modify the GUI thread-safe. Below is my form and my Circle class. Currently,...
3
1306
by: =?Utf-8?B?Qi4gQ2hlcm5pY2s=?= | last post by:
Ok guys, refresh my memory. I have a vague memory from years ago of a Dot Net 1.1 web app in which one window was opened from another (not a message box or anything like that, but a fully separate Internet Explorer. When the finish button was clicked, the second window while closing somehow triggered a refresh in the window that originally called it. What was this technique called?
0
7962
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
7884
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8267
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8024
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5423
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3880
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2394
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1493
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1229
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.