Selenium Basics – The very Beginning

Selenium Basics – The very Beginning

Dear readers, This is an article on Selenium where you will learn the very basics of Selenium. This article will cover the introductory topics of Selenium such as – what is Selenium, what programming languages and platforms it supports, its advantages and disadvantages compared to other automation tools.

This article is targeted towards those users, who are just starting their journey with test automation with Selenium. If you are a beginner, then this would be the first article that helps you start your journey with Selenium. More experienced readers can quickly scroll through this article and read the passages which you are more interested in.

What is Selenium and what does it do?

Selenium is a free and open source tool that automates web browsers – This is the simplest way in which you can define what Selenium is and what it does. If you have an web based applications that you test in your desktop browser, then it can be automated by Selenium.

Selenium Basics - What is SeleniumSelenium Basics - What is Selenium

(adsbygoogle = window.adsbygoogle || []).push({});

Is Selenium a single tool?

No. Selenium is not a single tool. It’s actually a suite of different tools that are used to automate web browsers. Depending upon your testing requirement, you can use one or more tools from the Selenium Suite. Selenium Suite consists of the following tools –

Selenium Tool SuiteSelenium Tool Suite

Let us look into each of these in brief so that you get an understanding of what these tools are all about. Since this is an introductory post, we will not get into detail in all the tools. We will give a brief overview of all these tools, so that it gives you an idea about what these tools generally do.

1. Selenium WebDriver : Selenium WebDriver is the most commonly used automation tool within Selenium tool suite, which automates the web application by speaking directly to the browser using the ‘native’ method for the browser and operating system.

Since Selenium WebDriver is the most popular and most used tool in the Selenium suite, it is referred simply as Selenium. So whenever someone mentions Selenium, its most likely that they are talking about Selenium WebDriver.

2. Selenium RC : Selenium RC or Selenium Remote Control is the first tool in the Selenium tool suite, which uses JavaScript based library to interact with web pages. While Selenium RC was a tremendous tool, it had its own drawbacks. Because of its JavaScript based automation engine and the security limitations browsers apply to JavaScript, there were lot of restrictions on what all Selenium RC could do.

(adsbygoogle = window.adsbygoogle || []).push({});

Selenium RC is now deprecated and is not actively supported by the Selenium Developers.

3. Selenium IDE : Selenium IDE (Integrated Development Environment) is a Firefox plugin and provides an easy-to-use interface for developing automated test scripts. Selenium IDE has a recording feature, using which you can record your actions on the browser and then exports them as a reusable script that can be later executed.

4. Selenium Grid : Selenium Grid is a tool that allows you to run your test cases in parallel, that is, you can run different tests at the same time on different remote machines. This parallel execution would be especially helpful when you have a large number of test scripts to be executed.

So many Selenium tools. Which ones should I use?

Well, this is an important question and in most cases its very easy to answer. A lot of times it depends upon what is your specific requirement. The below points will help us arrive at this decision.

  • Selenium RC is not used any more. Due to some of the limitations that we had mentioned above, Selenium RC has not been a preferred tool for a long time. So if you are beginner, it would be a good idea to not focus on Selenium RC much. A lot of Selenium RC features has anyways been incorporated in Selenium WebDriver, so you wont be missing out on these features.
  • Selenium IDE provides a decent record option, but I have never seen it being used in automation frameworks. So from my personal point of view, I would not spend much time on it
  • Selenium Grid helps with parallel execution of test scripts on remote machines, but there are very few projects where you will actually use Selenium Grid. I would say that its a very good tool to learn, but its something that is not used very commonly

Looking at all these points, its safe to assume that Selenium WebDriver is the tool that you should focus on first. Its the tool that is most commonly used. A look at the below trend supports this argument. You can see below that Selenium WebDriver is the most commonly searched keyword among other Selenium tools. This would roughly translate to the fact that Selenium WebDriver is the most commonly used tool in the Selenium tool suite.

trends.embed.renderExploreWidget(“TIMESERIES”, {“comparisonItem”:[{“keyword”:”selenium webdriver”,”geo”:””,”time”:”today 5-y”},{“keyword”:”selenium rc”,”geo”:””,”time”:”today 5-y”},{“keyword”:”selenium ide”,”geo”:””,”time”:”today 5-y”},{“keyword”:”selenium grid”,”geo”:””,”time”:”today 5-y”}],”category”:0,”property”:””}, {“guestPath”:””});

Different Browsers supported by Selenium

One advantage of using Selenium is the seamless support it provides for multiple browsers. Selenium has the support of some of the largest browser vendors who have taken (or are taking) steps to make Selenium a native part of their browser. Below are some of the browsers that can be automated by Selenium (WebDriver) –

  • Firefox
  • Chrome
  • Internet Explorer
  • Microsoft Edge
  • Safari
  • Opera
  • HtmlUnit
  • PhantomJS

Together with the browsers, you would also need to take care of the browser versions. Not all browser versions are supported by different versions of Selenium tools. Again, as we mentioned previously, we are not getting much into too much details at this point. The thumb rule is to use the latest version of Selenium and the latest version of your browser. If you have any specific query about any particular version of browser, the please contact us using the comments section.

Different Operating Systems where you can use Selenium

You can use Selenium on the following operating systems –

  • Microsoft Windows – Most versions of Windows support Selenium. I have personally used Selenium on Windows 7 and Windows 10 and its works well without any issues.
  • Apple OS X – Selenium generally supports the current stable release and often the previous release
  • Linux – Selenium works on Ubuntu and other major variants of Linux

Platforms and technologies supported by SeleniumPlatforms and technologies supported by Selenium

Different Programming Languages in which you can write your Selenium Scripts

Below are the different programming languages in which you can write your Selenium Scripts. Most commonly used ones are Java and C#, but there are others as well which you can use –

  • C#
  • Haskell
  • Java
  • JavaScript
  • Objective-C
  • Perl
  • PHP
  • Python
  • R
  • Ruby

Selenium supports these many programming languages through Selenium “drivers.” These are libraries created for each programming language. When using a particular programming language, you should use the driver or library for that particular language. We will cover these topics in more detail where we start working with the test scripts.

Testing Frameworks that you can use with Selenium

The primary purpose of using Selenium is is to automate web applications for testing purpose. Although Selenium doesn’t provide a testing framework of its own, you can use the frameworks provided by various programming languages. Following are the testing frameworks supported by Selenium –

  • JUnit and TestNG – with Java
  • NUnit – with C#
  • WebdriverJS, WebdriverIO, NightwatchJS – with JavaScript
  • Behat + Mink – with PHP
  • unittest, pyunit, py.test, robot framework – with Python
  • RSpec, Test::Unit – with Ruby

Again, if you are beginner with Selenium then don’t worry about all these testing frameworks if you have not worked with these. We will cover these later in detail as part of our tutorial series.

Selenium – Advantages and Disadvantages

Let us now see how Selenium stands in comparison with other automated tools. You might have a question as to why this is important? Well, as an automated tester, you would want to work with the tools that are best suited for your application. Together with that, it will also be great if the tool is popular and can add good value to your CV. This is where Selenium is important. Today, Selenium is one of the most widely used test automation tools in the world. And the usage of Selenium is following an upward trajectory, as seen in the below graph. This is evident due to the fact that the penetration of internet has grown exponentially all over the world. Due to this, a lot of testing is happening on web based applications – browsers and mobiles. And Selenium is an ideal tool for automation in this space.

trends.embed.renderExploreWidget(“TIMESERIES”, {“comparisonItem”:[{“keyword”:”/m/0c828v”,”geo”:””,”time”:”all”},{“keyword”:”QTP”,”geo”:””,”time”:”all”},{“keyword”:”UFT”,”geo”:””,”time”:”all”},{“keyword”:”TestComplete”,”geo”:””,”time”:”all”},{“keyword”:”/m/010vtynd”,”geo”:””,”time”:”all”}],”category”:0,”property”:””}, {“guestPath”:””});

Selenium advantages over other automation tools
1. One of the biggest advantage of Selenium is that its free and Open Source. Due to this, you would not have any restrictions on the basis of buying this tool. You can download it start using it as and when you want.
2. Selenium supports a wide variety of programming languages. This way, you wont need to learn a particular programming language to use Selenium. As we mentioned above, Selenium supports a wide variety of programming languages and you an use any of these to write your Selenium scripts.
3. Seamless support for cross browser testing is also a big advantage. We have a lot of browsers today and we would need to make sure that our web applications work well on all these browsers. This is where Selenium scripts would come in very handy
4. Support for mobile testing is another big advantage. Selenium supports mobile based testing through various third party drivers

Disadvantages of Selenium
1. One of the biggest disadvantage of Selenium is that it supports only Web browser testing. It doesn’t support desktop based applications. Due to this, you will see that Selenium will never be used where you need to testing in enterprise wide applications suite, where you have a lot of different E2E applications on different technology stacks – such as desktop apps, unix, mainframe etc.
2. Selenium has a higher learning curve compared to many licensed and paid tools. A lot of tools come with good IDEs which provide many features such as record & playback, script-less automation etc. Selenium doesn’t provide any such features. Hence there is a substantial learning curve when you use Selenium.
3. Lack of professional customer support. Since Selenium is a free tool, you don’t get the kind of professional support that you get with other paid tools like QTP. Although Selenium has a very good support in the form of forums and user groups, where you get queries and doubts answered by hundreds and thousands of users using Selenium, but dedicated support is something you only get with paid tools.

With this, we complete our article on Selenium Basics. Hope you enjoyed reading this article. If you have any doubts about any of these concepts, you can contact us using the comments section.

Help us improve this article!! If you figure out that we missed something, or you think that we can add something to make this more useful to you, then please share the details with us. We will try our best to make this a good learning experience for everyone.



Leave a Reply

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