DEV Community

Sujitha
Sujitha

Posted on

Selenium Architecture

Selenium WebDriver Architecture:

  • Selenium WebDriver is currently the most widely used component in the Selenium tool suite. Selenium WebDriver: Selenium 2 integrated with WebDriver API provides an understandable programming interface. JAVA and C# languages are mostly preferred to work with Selenium.
  • Through test scripts, WebDriver simulates user actions, navigates through web pages, interacts with elements (such as button, text, dropdown menu, forms, links, etc), submit forms, perform validations, assertions and many more.

Image description

Architecture of Selenium WebDriver (Selenium 3):

  • In Selenium 3, there is no direct communication between the client libraries (Java, Python, JavaScript, etc) and the browser drivers. The server (browser drivers) does not understand language but only the protocols and on the other hand, client libraries does not understand protocols used by browser drivers.
  • Therefore, JSON Wire protocol is being used as a mediator between client and server to encode and decode the requests and responses made by client and server respectively. This results in limited browser interaction, inefficient communication and lack of standardization which ultimately led to flaky test and slower test execution.

Architecture of Selenium 4 WebDriver:

Image description

The architecture of Selenium is composed of:

1. Selenium IDE:
Selenium IDE (Integrated Development Environment) is primarily a record/run tool that a test case developer uses to develop Selenium Test cases. It is just a web-browser extension.
Selenium IDE is an easy-to-use tool from the Selenium Test Suite and can even be used by someone new to developing automated test cases for their web applications.

2. Selenium Remote Control:
Selenium RC is an important component in the Selenium test suite. It is a testing framework that enables a QA or a developer to write test cases in any programming language in order to automate UI tests for web applications against any HTTP website.

3. Selenium WebDriver:
Selenium WebDriver is a web framework that permits you to execute cross-browser tests. This tool is used for automating web-based application testing to verify that it performs expectedly. Selenium WebDriver allows you to choose a programming language to create test scripts.

Selenium WebDriver Architecture is made up of four major components:

Image description

  • Selenium Client library: Selenium provides support to multiple libraries such as Ruby, Python, Java, etc as language bindings
  • JSON wire protocol over HTTP: JSON is an acronym for JavaScript Object Notation. It is an open standard that provides a transport mechanism for transferring data between client and server on the web.
  • Browser Drivers: Selenium browser drivers are native to each browser, interacting with the browser by establishing a secure connection. Selenium supports different browser drivers such as ChromeDriver, GeckoDriver, Microsoft Edge WebDriver, SafariDriver, and InternetExplorerDriver.
  • Browsers: Selenium provides support for multiple browsers like Chrome, Firefox, Safari, Internet Explorer etc.

4. Selenium Grid
It is used to run parallel tests on multiple devices running different browsers at different geographical locations
We can run multiple test-cases simultaneously at one moment of time
It used the Hub-Node architecture or Master-Slave architecture

Python virtual environment:

Python virtual environments give you the ability to isolate your Python development projects from your system installed Python and other Python environments. This gives you full control of your project and makes it easily reproducible

Usage of Python Virtual Environment

From terminal / command-prompt

  • Check the version of Python virtual environment

    virtualenv --version

  • Create a Python Virtual environment

    virtualenv

  • Activate your Python Virtual environment
    _ Scripts\activate_

  • Deactivate your Python Virtual environment

    Scripts\deactivate

Pycharm:
PyCharm makes it possible to use the virtualenv tool to create a project-specific isolated virtual environment. The main purpose of virtual environments is to manage settings and dependencies of a particular project regardless of other Python projects.

Top comments (0)