Selenium – COMPONENTS

Selenium is an open-source umbrella project for a range of tools and libraries aimed at supporting browser automation.it provides a playback tool for authoring functional tests across most modern web browsers, without the need to learn a test scripting language (Selenium IDE). It also provides a test domain-specific language (Selenese) to write tests in a number of popular programming languages, including JavaScript, Groovy, Java, Perl, Python. Selenium runs on Windows, Linux, and macOS. It is open-source software released under the Apache License 2.0. 

Components 

Selenium IDE

Selenium IDE is a complete integrated development environment (IDE) for Selenium tests. It is implemented as a Firefox Add-On and as a Chrome Extension. It allows for recording, editing and debugging of functional tests. It was previously known as Selenium Recorder. Selenium-IDE was originally created by Shinya Kasatani and donated to the Selenium project in 2006. Selenium IDE began being actively maintained in 2018. Selenium Remote Control Selenium Remote Control (RC) is a server, written in Java, that accepts commands for the browser via HTTP. RC makes it possible to write automated tests for a web application in any programming language, which allows for better integration of Selenium in existing unit test frameworks. To make writing tests easier, Selenium project currently provides client drivers for PHP, Python, Perl and Java.

Selenium WebDriver 

At the core of Selenium is Selenium WebDriver, an interface to write instructions that work interchangeably across browsers. It is the successor to Selenium RC. Selenium WebDriver accepts commands (sent in Selenese, or via a client API) and sends them to a browser. This is implemented through a browser-specific browser driver, which sends commands to a browser and retrieves results. Most browser drivers actually launch and access a browser application (such as Firefox, Google Chrome, Internet Explorer, Safari, or Microsoft Edge); there is also an HTML Unit browser driver, which simulates a browser using the headless browser HTML Unit. 

Selenium Grid 

Selenium Grid is a server that allows tests to use web browser instances running on remote machines. With Selenium Grid, one server acts as the central hub. Tests contact the hub to obtain access to browser instances. The hub has a list of servers that provide access to browser instances (WebDriver nodes), and lets tests use these instances. Selenium Grid allows running tests in parallel on multiple machines and to manage different browser versions and browser configurations centrally (instead of in each individual test).  

Example 

Python

from selenium import webdriver 
from selenium.webdriver.common.by import By 
from selenium.webdriver.common.keys import Keys 
from selenium.webdriver.support.ui import WebDriverWait 
from selenium.webdriver.support.expected_conditions import presence_of_element_located 
 
#This example requires Selenium WebDriver 3.13 or newer 
with webdriver.Firefox() as driver: 
    wait = WebDriverWait(driver, 10) 
    driver.get(“https://google.com/ncr”) 
    driver.find_element(By.NAME, “q”).send_keys(“cheese” + Keys.RETURN) 
    first_result = wait.until(presence_of_element_located((By.CSS_SELECTOR, “h3”))) 
    print(first_result.get_attribute(“textContent”)) 

 

Leave a comment

Your email address will not be published. Required fields are marked *