1

I am trying to use Selenium to visit a website with a few dozen sessions at a time, but whenever I try and setup more than 9 sessions, it says "chromedriver.exe is not responding" and the sessions start closing themselves.

Here is my code:

from selenium import webdriver
import time

url = "website URL"
amount = 36

def generateBrowsers():
    for x in range(0, amount):
        driver = webdriver.Chrome(executable_path="C:/Users/user/Documents/chromedriver_win32/chromedriver.exe")
        driver.get(url)
        time.sleep(3)

generateBrowsers()

Does anyone know what could be wrong?

Jongware
  • 21,058
  • 8
  • 43
  • 86
Jack P
  • 189
  • 2
  • 11

1 Answers1

1

Logically, your code block have No Errors.

But as you are trying to open 36 Sessions at a time you need to consider the following facts :

  • Each call to driver = webdriver.Chrome(executable_path="C:/Users/user/Documents/chromedriver_win32/chromedriver.exe") will initiate :

    1. A new WebDriver instance
    2. A new Web Browser instance
    
  • Each of the WebDriver instance and Web Browser instance will need to occupy some amount of :

    1. CPU
    2. Memory
    3. Network
    4. Cache
    

Now, as you execute your Test Suite from your system which also runs a lot other Applications (some of them may be on Start Up) tries to accomodate within the available CPU, Memory, Network or Cache. So whenever, the usage of mentioned parameters gets beyond the threshhold level, either the next new chromedriver.exe or the chrome.exe will be unable to spawn out properly. In your case chromedriver.exe was unable to spawn out. Hence you see the error :

chromedriver.exe is not responding

Solution

If you have a requirement of spawning 36 Sessions at a time you need to use :

  • Selenium in Grid Configuration : Selenium Grid consists of a Hub and Node and you will be able to distribute required number of sessions among number of Nodes.
DebanjanB
  • 118,661
  • 30
  • 168
  • 217