📜 ⬆️ ⬇️

Selenium: New Hope

I present to you the translation of my article on Medium.com: part 1 , part 2 . Since the first part of the article contains mostly already stated in this post , I cite the translation of only the second part.



Lose weight and move to containers


In the first part of the article, I talked about simple approaches that allow building a scalable Selenium cluster without writing code. In this part we will consider more subtle issues of working with Selenium:


  1. How to create highly scalable work nodes using standard Selenium Hub
  2. Why it is possible and necessary to run most browsers in containers and how it is done
  3. What open-source tools for this exist


What's inside the work node


All the new tools described in the first part are in fact smart lightweight proxies that redirect user requests to real Selenium hubs and nodes. If you reflect a little, then questions arise:


  1. How to organize hubs and nodes to effectively consume hardware resources and scale well?
  2. What operating system to use?
  3. What programs should be installed?
  4. Can I work without a monitor?

One way would be to use hardware with one Selenium hub and multiple nodes with different browsers. It looks reasonable, but actually uncomfortable:



  1. As it was said, the Selenium hub with a large number of loaded nodes works very slowly. Not sure about the real reasons, but practice shows exactly that. My advice - do not read the source code of Selenium at night, if you do not want to have nightmares. Thus, we cannot use dozens of Selenium nodes with the same hub. It remains to use one hub and only a few nodes. To effectively use iron, you need to reduce the total number of cores per hub — a good reason to move to the clouds. For example, our working grid for a long time used small virtual machines with 2 cores and 4 GB of memory.
  2. It is not clear how to install different versions of the same browser in a simple way (for example, from packages).
  3. It is not clear how easy it is to take into account the total number of browsers of one version available.
  4. Different versions of Selenium nodes are compatible with different versions of browsers, i.e. a newer Selenium node may not support an older browser.

The easiest way to have the same number of nodes per hub is to run them inside a single virtual machine. If each browser version is a separate virtual machine, then counting the total number of available browsers becomes an elementary school task. You can easily add and remove virtual machines that contain compatible versions of the node and browser. We recommend this approach when installing a Selenium cluster in the cloud with a constantly available number of each browser version.



What else besides Selenium hub and node is located inside the virtual machine for everything to work?



')

Source: https://habr.com/ru/post/322742/


All Articles