I am running some time dependent tests in selenium. For some reason when a insatiate a chrome driver, the load time of the browser window is varying. How can I fix this to get the load times consistent and stop the chrome browser windows from loading so slow?
It has nothing in common with Selenium, you need to get a snapshot of what's going on with your operating system when you launch the browser, for example using Windows Performance Monitor
Blind shot: Chrome browser is very memory intensive (you can check how much RAM it consumes using Windows Task Manager and if your machine is short on RAM it starts intensively using page file to store some memory pages to disk and since disk is much slower comparing to the RAM - you're getting inconsistent results.
The only way of effective speeding up Selenium tests is Parallel Execution via Selenium Grid or by means of your underlying unit testing framework.
Related
What is the difference between
Using the performance testing tool directly(Jmeter ,..)
Integrate the performance testing tool with selenium using plugin(Jmeter ,..).
Whether I can achieve all the functionalities in both the ways.
If used as a plugin will there be any limitations?
Thanks.
Performance testing tool acts on HTTP protocol level, basically pretty much the same as browser does, however in particular JMeter:
JMeter is not a browser, it works at protocol level. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the Javascript found in HTML pages. Nor does it render the HTML pages as a browser does (it's possible to view the response as HTML etc., but the timings are not included in any samples, and only one sample in one thread is ever displayed at a time).
therefore you can only test backend performance using JMeter however you will not get client-side performance metrics
Protocol-based tests have much less footprint in terms of resources (CPU, RAM, etc.) so you can simulate thousands of virtual users from a mid-range modern laptop.
Selenium is a browser automation framework, it operates real browsers so:
you have client-side performance metrics (including ability to query Window.Performance metrics)
and you don't have HTTP-protocol related metrics (connect time, latency, concurrency, throughput, etc.)
Browser-based tests have huge footprint in terms of resources as browsers are very resource intensive, for example Firefox 74 requires 1 CPU core and 2 GB of RAM per browser instance so you can kick off only several browsers on a mid-range modern laptop
Depending on your requirements you might want to either test the backend using JMeter or the frontend using Selenium or create the main load using JMeter and use 1-2 real browsers to test client-side performance.
If you're looking for a way of integrating JMeter with Selenium take a look at WebDriver Sampler (it's a JMeter Plugin which can be installed using JMeter Plugins Manager)
I'm trying to use an EC2 instance to run several Selenium chromedrivers in parallel. When I run just one, it works fine. But as soon as I start a second Selenium process, both processes fail (as in, page loads hit max timeouts after a couple minutes).
I'm using a t3.large instance, which has 8gb RAM and 5Gbps of network bandwidth. It's not a cheap instance and costs $2 per day. I'm surprised that with these specs, it can't handle two concurrent Selenium processes because my personal laptop has no problem handling 4+ Selenium processes.
Additional info: I'm using pyvirtualdisplay on the EC2 box.
Wondering if I'm missing something here that is causing the poor performance.
I try to run 10 user accessing a website concurrency by using Selenium Webdriver in JUnit and it caused my PC to lag because it open 10 Browser at the same time. I even tried to run Jmeter in Command Prompt, it is just laggy. Is there any methods to actually run 1000 user concurrently without stressing my PC?
Each browser has its system requirements, for example for Firefox 71 they are:
512MB of RAM / 2GB of RAM for the 64-bit version
Pentium 4 or newer processor that supports SSE2
If you want to kick off several browsers - you need to have:
2 GB of RAM per browser instance
1 CPU core per browser instance
For 10 browsers you will need to have 11+ CPU cores and 22+ GB of RAM, for 1000 browsers - proportionally more.
If you have to conduct performance testing using real browsers you will need to go for Distributed Testing and allocate sufficient amount of machines to act as load generators. Remember that machines must not be overloaded as if they will not be able to operate fast enough - you won't get accurate results.
Another option is migrating your Selenium tests to JMeter, you can basically run your Selenium tests through JMeter proxy so JMeter will be able to capture the relevant HTTP requests and convert them into HTTP Request samplers or replay them via Proxy2JMX Converter module of Taurus tool, check out How to Convert Selenium Scripts into the JMX article for more details.
JMeter's HTTP Request samplers have very small footprint comparing to real browsers so you will be able to mimic several thousands of virtual users from a modern mid-range laptop given you follow JMeter Best Practices
I want to run an automatic test develop with Protractor in parallel on 50 instances of google chrome using selenium grid on an 8CPU machine and 16GB RAM. but the machine becomes very slow and the load averge exceeds 40.
There is someone who can help me to increase the instances of chrome on this machine
Check Aerokube guys solution, it works way faster than original Selenium Grid:
Selenoid - Go implementation of original Selenium hub code. It
is using Docker to launch browsers.
GGR - A lightweight load
balancer used to create big Selenium clusters
I am running a Selenium test suite on multiple browsers on a remote Apple Mini. I schedule these tests with Bamboo.
When running the tests on Chrome, they are extremely slow and some actions timeout, causing the tests to fail.
More interestingly, this only happens when Bamboo kicks off the test. When I kick off the tests from my local computer, they run fine.
I have read that Chromedriver performs poorly sometimes when automatically detecting proxy settings. I have addressed this but still the performance is poor.
Has something like this happened to others and does anyone know what could cause something like this?
Something similar happens to me.
The root cause can be in the network connection between the Bamboo server (where the project is built) and the Selenium server (which probably runs on another machine).
When you kick off tests suite from your local machine, you probably have the project build and Selenium running at the same place. So, the commands sent to Selenium do not have to pass the network stage and there are almost no delays.
Try to eliminate the slow connection or investigate if it is possible to build and launch your tests on the machine which runs the Selenium server.
I had this when running tests on Team City with multiple browsers on a remote Mac Mini.
After much head scratching we stumble upon the fact that tests sped up if we remotely connected or connected a monitor to the Mac Mini.
We can only assume that the Mac Mini is smart enough to reduce resource to GUI activities if it knows there is no mechanism to attach a GUI.
Therefore, we purchased a very cheap monitor and left it attached to the MAc Mini, and all started running normally