I have a python script, which uses Selenium. I need to run multiple instances of the script at the same time, that is, the same script run multiple times with the different arguments:
python my_script.py --arg1 2222222
python my_script.py --arg1 222
python my_script.py --arg1 342432
In the code they all use the same browser (not the same window, but the same browser). Each script uses only one thread in it if that matters.
So is it ok to run them all at the same time? Can it lead to a misbehaviour? Or generally everything should be ok?
I haven't found an information at Selenium website about that.
And also and more importantly, will they share cache/proxies/cookies or will each instance of a browser have its own ones? For example, if I run 5 scripts so each one will have its own browser, say, Firefox, will each Firefox have its own cache/proxies/cookies?
Everytime we invoke browser through Selenium, it creates a new instance thread of specified browser. If you have defined DesiredCapabilities those specific settings will be applied to the browser instance that gets invoked.
This is the exact reason, you can run selenium tests parallel fashion, running multiple instances of the browser, where each browser is getting executed with different scripts.
http://www.guru99.com/sessions-parallel-run-and-dependency-in-selenium.html gives little bit of information about how selenium handles browser instances.
Browser starts from clean state where No Cache/Proxy/Cookies are stored. You can notice that selenium launched browser instance will not have any extensions/add-ons.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With