1

Can anyone help me to calculate how many Selenium driven automated browser can be initiated on a single computer at the same time?

Note: If it matters, I am using ChromeDriver and Chrome for this purpose through C# Selenium bindings.

DebanjanB
  • 118,661
  • 30
  • 168
  • 217
Riza
  • 31
  • 1
  • 5
  • Do you know what is your system RAM where you are running this? it how how much Ram is consumed by single driver execution? Both Answers calculation will be the Rough answer. – MarmiK Mar 12 '19 at 14:44

3 Answers3

2

Answering straight, factually there is no definite way to calculate how many automated browsers can be initiated on a single computer at the same time using Selenium.

Initiation of new ChromeDriver and ChromeBrowser processes would largely depend on the available CPU and Memory. We have discussed about CPU and Memory related issues in length under the following topics:

  • How to limit chrome headless CPU and memory usage. Here you can find the detailed discussion.
  • GeckoDriver process was impacting PC memory. Here you can find the detailed discussion.
  • If it possible to reduce memory RAM consumption when using Selenium GeckoDriver and Firefox. Here you can find the detailed discussion.
  • Selenium using too much RAM with Firefox. Here you can find the detailed discussion.
DebanjanB
  • 118,661
  • 30
  • 168
  • 217
1

I think @DebanjanB is spot on. As to how it can be done, multiple threads should be able to spin up multiple chrome instances. Again, there are many variables involved in answering your actual question.

public void Work()
{
IWebDriver driver = new ChromeDriver("D:\\Drivers");
driver.Navigate().GoToUrl(URL);
\\Do the rest
}
public void Work2()
{
IWebDriver driver = new ChromeDriver("D:\\Drivers");
driver.Navigate().GoToUrl(URL2);
\\Do the rest
}

and call the functions like this:

Thread thread1 = new Thread(new ThreadStart(Work));
thread1.Start();
Thread thread2 = new Thread(new ThreadStart(Work2));
thread2.Start();
C. Peck
  • 2,176
  • 1
  • 12
  • 31
  • 1
    Note that _WebDriver_ is not **thread-safe**.The issue of thread-safety isn't in your code but in the actual browser bindings. – DebanjanB Mar 12 '19 at 12:46
1

It depends on how much RAM your computer has and how heavy the website under test is. For example, if you have 8GB of RAM in total and 5GB free, then you may have 10 browsers with lots of content/logic inside, each taking 500MB. However if the website under test is simple, then it may take around 30-100MB, and you can accommodate around 50 instances. However, at this point - depending on what the website does, your CPU/network may become a bottleneck.

Lanki
  • 121
  • 1
  • 9
adlerer
  • 606
  • 6
  • 10