Reputation: 31
I want to use Selenium on a certain website. I have to open the website multiple times simultaneously with each instance having an unique session. I can open multiple windows but can't seem to create an unique session for each one.
I did some research and found Selenium Grid and some online platforms which can run all kinds of browsers to test your application but this seems to be more complicated than it has to be.
So how can I use Selenium to visit a website multiple times simultaneously with each one having an unique session?
Kind Regards,
Martin
Upvotes: 3
Views: 2935
Reputation: 20749
I once answered a similar question.
Selenium actually runs private mode by default. Every time you start any driver via Selenium it creates a brand new anonymous profile/session.
This means that you can instantiate multiple drivers, which will open multiple new windows and each of those should normally not be influenced by the others.
For instance the code:
from selenium import webdriver
import time
driver1 = webdriver.Firefox()
driver1.get("http://www.python.org")
driver2 = webdriver.Firefox()
driver2.get("http://www.python.org")
time.sleep( 20 )
will open 2 windows that are using different sessions. I used the sleep
method, so you can see the windows visually.
Upvotes: 1