Skip to main content

Selenium - What Why Who How?


What is Selenium?
Selenium is an open source automated testing suite for web applications across different browsers and platforms. It is quite similar to HP Quick Test Pro (QTP) only that Selenium focuses on automating web-based applications.
Why use Selenium?
Selenium is fast and it supports programming in multiple languages like Java, C#,Python and Ruby. 
So development of automation scripts can be done in your language of preference. Selenium works well with AJAX testing. Selenium Grid supports execution of test cases in multiple platforms and multiple browsers in remote systems as well. 

The support for different programming languages gave selenium the power to harness the capabilities of those programming languages
For example, using JAVA as the programming language to code selenium scripts enables selenium to use JDBC for database access and testing.All the APIs supported in Java also become the advantage of Selenium like Log4j API, Apache POI.

Its free!!!!

Who should use Selenium?

Selenium is mainly used across organizations trying to reduce Automation costs. 
Selenium should be used by people who want to test Web applications in multiple operating systems across multiple browsers.

How Selenium evolved and How to use Selenium?

Selenium is not just a single tool but a suite of softwares, each catering to different testing needs of an organization. It has four components.
  •          Selenium Integrated Development Environment (IDE)
  •          Selenium Remote Control (RC)
  •          Web Driver
  •          Selenium Grid


Selenium IDE


Selenium IDE is a Firefox extension that can automate the browser through a record-and-playback feature.
Once you click on record, the actions you perform in the Firefox browser are recorded and a test case is created. This test case can be exported to the supported formats and languages preferred by the user. The exported test cases can be used in Selenium RC or WebDriver.

Selenium Remote Control

Selenium Core is a JavaScript program that works by injecting JavaScript into the html page which performs actions like the end user. The disadvantage of this is because of same origin policy, users had to have the AUT and Selenium Core installed in their local machine.
To overcome this, another engineer created a server that will act as an HTTP proxy to "trick" the browser into believing that Selenium Core and the web application being tested come from the same domain. This system became known as the Selenium Remote Control or Selenium 1.

WebDriver

When browsers and web applications were becoming more powerful and more restrictive with JavaScript programs like Selenium Core, WebDriver was the first cross-platform testing framework that could control the browser from the OS level.
WebDriver was faster because it eliminated the need of the HTTP proxy aka server between the script and AUT.

Selenium Grid

Selenium Grid was developed to address the need of minimizing test execution times as much as possible. He initially called the system "Hosted QA." It was capable of capturing browser screenshots during significant stages, and also of sending out Selenium commands to different machines simultaneously.

Selenium 2

Selenium RC and WebDriver were merged to make a more powerful tool called selenium 2. Its fast and it supports programming in multiple languages like Java, C#,Python and Ruby. 


Comments

Popular posts from this blog

How to Install Selenium and execute your first program

You can install and test Selenium using the following steps. All files can be downloaded from  http://www.seleniumhq.org/download/   Download Selenium Server jar file   Download client library java jar file   Download InternetExplorer Driver file   Install eclipse workspace. (download eclipse. Unzip folder. Find eclipse.exe application and open it) Create a new java project with 1,2 as references Copy 3 to workspace For IE, go to internet options->security and change the security level so that it’s the same for all zones. Write sample java program Below program opens google in IE and searches for selenium test and closes it. // All the imports happen automatically when you use eclipse ide and add the downloaded jars in the project references package test; import org.openqa.selenium.Alert; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.ie...

Form - User Input Automation

Text boxes WebElement t=driver.findElement(By.id(“username”)); t.sendkeys(“test name”); Buttons WebElement t=driver.findElement(By.id(“createbutton”)); t.click(); DropDown Boxes  WebElement select = driver.findElement(By.tagName("select")); List<WebElement> allOptions = select.findElements(By.tagName("option")); for (WebElement option : allOptions) { System.out.println(String.format("Value is: %s", option.getAttribute("value"))); option.click(); } This will find the first “SELECT” element on the page, and cycle through each of its OPTIONs in turn, printing out their values, and selecting each in turn. As you will notice, this isn’t the most efficient way of dealing with SELECT elements. WebDriver’s support classes include one called “Select”, which provides useful methods for interacting with these Select oSelection = new Select(driver.findElement(By.tagName("select"))); oSelection.deselectAll(); //All op...

Switch between browsers\windows and pop ups

These commands can be used to switch between windows, iterate through different windows opened by the webdriver, handle pop ups and frames in windows.  GetWindowHandle Command Purpose : To get the   window handle   of the current window. driver.getWindowHandle(); Returns an alphanumeric string GetWindowHandles Command Purpose : To get the   window handle   of   all   the current windows. Set<String> handle=Driver.getWindowHandles(); Returns a set of window handles SwitchTo Window Command Purpose : WebDriver supports   moving   between named windows using the “switchTo” method. For(String handle:driver.getWindowHandles()) Driver.switchto().window(handle); Or Driver.switchto().window(windowname); <A href="newwindow.html" target=" windowname ">click here for a new window </A> SwitchTo Frame Command Purpose : WebDriver supports moving between frames using the “ switchTo ” method. Driver.s...