Reputation: 6872
I am using multiple webdrivers with different threads. However, drivers are consuming a lot of memory and cpu usage. I am looking for efficient solution which can utilise many drivers usage with low memory/cpu footprint.
I have the following code:
for (int i = 0; i < 200; i++) {
Thread t = new Thread(this::workWithNewWebDriver, "Browser" + i);
t.start();
}
public void workWithNewWebDriver(){
ChromeOptions bestPerformanceOptions = new ChromeOptions();
WebDriver driver = new ChromeDriver(bestPerformanceOptions);
driver.get("anysite.com");
// Do stuff...
}
I am currently using that kind of user tests with selenium but framework is subject to change and I am looking for most performant lightweight solution.
Tests are only requiring user login and interactions, Any framework can click the button with a user is okay by me.
I have already tested the headless
option for selenium but it only gives a slight improvement to performance metrics.
Where can I find the preset of performant options for chrome driver?
How can I improve the performance of selenium that tests 200 different parallel users use case ie.?
Upvotes: 0
Views: 489
Reputation: 167992
I don't think you can, real browser means real browser and real browsers are resource intensive. For example Firefox 109 requires 1 CPU core and 2 GB or RAM per instance and Chrome tends to consume even more.
Moreover it is not recommended to use Selenium for performance testing in the Selenium official documentation, they suggest to use JMeter for that. Given you properly configure JMeter to behave like a real browser from the system under test point of view there will be no difference whether you use Selenium or JMeter for testing.
Upvotes: 1