How To Open Multiple Instances Of Firefox Using Python?
Can someone please help me on how to open multiple instances of firefox using selenium in python. I wrote the following code and it does open multiple instances but I would want to
Solution 1:
For one thing:
for i in range(2):
...
is much neater and less error-prone than:
i = 0
while i < 2:
...
i = i + 1 # or just 'i += 1'
But your main problem is that each time through the loop you replace the previous webdriver
, losing access to it:
self.driver = webdriver.Firefox()
Instead, consider a list:
self.drivers = []
for i inrange(2):
self.drivers.append(webdriver.Firefox())
...
now you retain access to all of them.
Post a Comment for "How To Open Multiple Instances Of Firefox Using Python?"