Why Selenium has an edge over other automation tools

Selenium is an open source set of libraries initially developed by ThoughtWorks. These libraries can be used with java, ruby, C#, perl, and other programming languages to interact with the web browser. Over time, selenium has evolved and became a widely used automation tool attributed to the wide community base which contributed to its enhancement, maintenance, and scalability. Thus selenium has gained an edge over other commercial tools available in the market. Getting started with selenium is easy and no commercial cost is involved for using selenium. It is free and easy to use. But unlike other commercial tools, it does not provide any UI to ease the automation. User has to write code even for slightest of web operation.

Components of selenium are :

RC
GRID
IDE
WEB DRIVER.

GRID and WEB DRIVER are the most commonly used components of selenium these days. Selenium RC became obsolete and replaced by webdriver. In Selenium RC, there used to be a separate server that acts as an interface between browser and selenium commands. On the other hand in selenium webdriver, a specific browser driver is initialized and invoked by webdriver object and executes selenium command without having anything acting in between.

Selenium Grid gives us the flexibility to execute our automation tests on various browsers, platforms, and operating systems. Visit our article SELENIUM GRID on how to create hub and nodes, define desired capabilities, and invoke remote web driver to execute automation tests on remote machines using selenium grid. Selenium IDE was used for record and playback.

Selenium support wide range of platforms and browsers. Below is the list of operating systems supported by selenium:

WINDOWS
MAC OS
LINUX

Below is the list of browsers supported by selenium:

CHROME
IE
FIREFOX
OPERA
EDGE
SAFARI

You can download selenium libraries from: Download selenium

You might be wondering when the selenium automation comes into the picture after seeing the below high-level life cycle
But it is not always at the end of the SDLC phase or during the testing phase. We’ll come to it in later posts.

In a nutshell, selenium webdriver is an interface that is used to interact with the browser. It is a collection of classes and comes in the form of a jar. It can be bound with any programming language like java, ruby , perl, C# to perform operations on browsers. Any web component which displays on the browser can be operated upon by a webdriver object. Out of the numerous operations performed by webdriver on web elements of a web page, some basic operations include inputting into text fields, clicking buttons, selecting radio buttons, click, right click, double click, mouse hover, drag and drop, a selection from dropdown, switching between the windows, and frames, handling alerts. Selenium web driver provides APIs and libraries to handle different aspects of web components.

Compare Home Loan Interest Rates To Find The Best One

Several banks and housing finance companies offer different home loan rates. If it was as simple as visiting a third party website and entering your details to compare the home loan interest rates, there was no need for this article. Yet, you know, there is certainly much more to it. So, how do you evaluate the best home loan rates in India ?

Put your best foot forward.

Clear your credit card debts and personal loans and get the best possible CIBIL credit score. You should revise your credit history without any damaging elements. Calculate the required down payment, since it will affect the banks and housing finance companies that approve your loan, interest rates offered, repayment strategy allowed and more.

You would need to start saving up to 20% of the principal amount. So, you should plan for it in advance as you will need all the necessary documents to demonstrate your assets, liabilities, investments and earnings. Your good position and salary in a reputed organization comes in handy too. Now, you are ready to compare the available home loan interest rates in India .

Apply, apply, and apply.

Most banks and housing finance companies have online eligibility calculators and loan application systems, which allow you to apply for home loan within a few minutes. When you apply for a loan, you receive realistic interest rates based on your repayment ability, income and potential to earn. As you receive approvals, you will get realistic interest rates and EMI projections as well. This is a great place to compare the loans as well as finance companies. As these rates are open for negotiations, though banks don’t encourage that practice, you can contact your loan officer and use this time to draft the best possible deal.

Compare the specifics too.

After comparing the home loan rates, you must compare minor details too as they help you to negotiate and customize the loan as per your convenience. Lenders with the best possible proposal would include the right repayment strategy, prepayment clauses etc. All comparisons will not help you to select the best deal. Yet, you must look into boring fine print documents such as terms and conditions that would shape your EMIs and financial life ahead.

No wonder the right foundation for a successful comparison and loan approval is thorough research. So, explore the details of the EMIs, documents, terms and conditions, repayment options and interest rates to finalize the home loan that suits you the best.

Getting started with Selenium

GETTING STARTED WITH SELENIUM

To start with selenium webdriver, you need to have the following items installed on your machine.
Prerequisite:

JDK (java 1.8 preferable)

Selenium libraries (Nowadays there is single jar ‘selenium-server-standalone.jar’ is enough unlike earlier period where we need to install multiple jars),

Browser drivers (.exe of chrome driver, ie driver, gecko driver)

Eclipse IDE

Now that you have downloaded the minimum required elements to start writing selenium code, so let’s start by setting up the environment:

Now select a java project:

Give the project name and finish.
Now configure the build path where you need to set your downloaded libraries i.e. selenium jar files, also need to set JDK and JRE path in the java compiler section. Right-click on your project and build path and configure build path.

Now select the libraries tab above and click add external jars. Add your downloaded selenium jars here:

Also now don’t forget to set your compliance level as per your JDK and JRE version.
For all your latest version of selenium, make sure the compliance level under the java compiler section must be set to java 1.8 or above. Ignoring this might lead to a “class not found” run time exception during running your selenium test script.

Now that you have set libraries and compliance levels, it’s time to write your first selenium code using java.
Right-click on your project and select create a new class.

Give it a name, check “public static void main..” , click finish. You are creating a sample test, where we are not using any testNG, cucumber, or maven therefore we need to include public static void main in our first class to run the test as the java execution will begin through the class where the main method is defined. In subsequent lectures, when we use testNG, cucumber, Maven, we will not use or include the main method as our execution will be taken care of by testNG or cucumber.

Now it’s time to write our first test script which simply opens the browser and navigate to the site specified in the script. We’ll write the code and understand the meaning of each one of them.
In our class, first include the required packages and classes which come with selenium libraries.

Now at class level, that is inside the class but before the main method, declare a webdriver instance variable:

Webdriver driver;

Now inside our main method, write code to set system property:

Here setProperty method is accepting two parameters in the form of key and value. The first one is the string parameter in which we are telling that we are going to use a chrome driver, and the second is also a string parameter where we are placing an entire path till the driver’s exe.
Now in the next line, we’ve initialized the driver with chromeDriver. This piece of the line will open the chrome browser upon execution. Now our browser is open, and we want to navigate to any site. This task will be done by driver.get(“”); method. So driver.get(“”) will land us to the specified URL.

INTERVIEW TIP: Why we cannot write Webdriver driver=new Webdriver();

Since webdriver is an interface therefore we can create its instance variable but cannot create its object. i.e. we cannot write Webdriver driver=new Webdriver(); this will throw error. We can rather write Webdriver driver =new FirefoxDriver(); or Webdriver driver=new ChromeDriver(); or Webdriver driver =new InternetExplorerDriver(); These FirefoxDriver, ChromeDriver, and InternetExplorerDriver are the actual classes which implement the webdriver interface and provide implementation to its methods. So we are assigning the instance variable of webdriver to its implementation classes.

SUMMARY

In this lecture, we’ve installed basic minimum items required for running and executing our first selenium script. We’ve installed JDK, eclipse, selenium libraries, drivers exe’s for browsers. We’ve created a java project, set all the libraries in our project’ build path, created a class, and imported the packages and classes needed to execute our test script. We’ve written the code to set system property, initialized our driver object, open the browser, and finally lands at the site specified in the driver.get(“”).