Skip to main content

Selenium - Basics

Selenium:

Selenium is an open source automated testing Suite for web applications across different browsers and platforms.

Selenium has 4 major components:

  1. Selenium Integrated Development Environment(IDE)
  2. Selenium Remote Control(RC)
  3. Web Driver
  4. Selenium Grid

1. Selenium Integrated Development Environment:

Selenium IDE is the simplest framework in the Selenium Suite and very easiest to learn. It has got record playback and saving tests and inbuilt reporting tool. 


2. Selenium Remote Control:

Selenium RC was the flagship testing framework of the whole Selenium project for a long time.
This is the first automated web testing tool where it allows users to use their programming language they prefer.

RC comes in 2 forms:

2.1 Selenium Server:     
  • Selenium Server receives selenium commands from your program, interprets them and reports  back the results of those running tests.
  • Selenium Core is a Java Script program which executes selenium commands using  browser's built-in Java Script Interpreter.
  • Server receives selenium commands from your program using simple HTTP GET/POST requests.

2.2 Client Libraries:
  • Client libraries which provide the application interface between each programming language and the Selenium RC Server. eg : Python , Java , PHP etc

As of version 2.25.0 RC, it supports following languages
  • Java
  • C#
  • PHP
  • Python
  • Perl 
  • Ruby



3. WebDriver:

WebDriver itself proves it is better than Selenium IDE and RC.
It uses more object oriented approach eg: JsonWire Protocol and unlike RC, it doesn't rely on JavaScript for automation.
It is developed to support dynamic web pages where elements of the page may change without page reloading using AJAX.
Selenium WebDriver makes direct calls to the browser using native browser's support for automation.
RC injected javascript functions into the browser when browser was loaded and used its javascript to drive the AUT within the browser.



4. Selenium Grid:

Selenium Grid is a tool used together with Selenium RC to parallel tests across different machines or same machine but different browsers.
Uses Hub and Node concepts. The hub acts as a central source of selenium commands to each node connected to it.


My Personal Recommendation :

Use Selenium Web Driver for automating web browser operations and use any open source frameworks such as Robot Framework, Jasmine or Cucumber for logging and reporting. 

driver = webdriver.Chrome('path of local chromedriver.exe');



Selenium RC is useful when your test cases are in different machine and your web application is running in a different machine. In that scenario , we can run selenium-server on the hosted machine and consume the url , and can run the test against the url. 

driver = new RemoteWebDriver(new URL('http://172.20.20.39:4444/wd/hub'), capability);

Note: Selenium-Server should be running at 172.20.20.39 server and by default server will be running on port 4444.

Rest all browser session operations are same for both Selenium WebDriver and Selenium RC APIs.



Thank You!
Happy Learning

Comments

Post a Comment

Popular posts from this blog

Ansible

 What is Ansible Ansible is a configuration management, deployment and orchestration tool. Features of Ansible Simple: Simple to install and setup Built on top of Python: Provides lot of python functionality. SSH for Secure Connection  Agentless Platform independent  Push Based unlike Puppet and Chef Install and Setup: Install Ansible via pip install ansible   Generate SSH-Key on Master node using ssh-keygen -t rsa Goto /root/.ssh and copy id_rsa.pub key to all other nodes and  Run ssh-copy-id <Destination IP Address> By default, Ansible configuration file is located under  /etc/ansible/ansible.cfg and inventory file is pointed to  /etc/ansible/hosts ansible --version shows the version of ansible is using and the configuration file it is pointing to. We can create our own inventory file filename - inventory.ini [web_servers]  web01 web02 [db_servers] db01 db02 Create a ansible.cfg file under working directory or edit the default confi...

Selenium Xpath

XPath  XPath is abbreviated as XML Path.  Xpath is used to find the location of any element on the web page using HTML DOM structure. Basic format of XPath is : Xpath = //tagnanme[@attribute='value'] //  : Select current node. Tagname  : Tagname of the particular node. eg : input, img, div etc @   : Select attribute. Value   : Value of the attribute. Different locators are used to find the element on web pages accurately. ID  ClassName Name LinkText XPath CSSPath Types of XPath: Absolute XPath Relative XPath Absolute xpath: It is direct way to find the element right from the root element of the webpage. The disadvantage of the absolute xpath is that if there are any changes made in the path of the element then xpath gets failed. It begins with the single forward slash(/), which means you can select the element from the root node. example : html/body/div[1]/section/div[1]/div/div/div/div[1]/div/di...