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(“”).

Difference between Test Planning and Test Strategy

Test Plan is a road map to testing. A test plan defines the blue print or approach to testing. Following questions are answered in a test plan:

How the testing will be carried out
What will be the approach
How we will proceed with testing
Testing strategy
Features to be tested
Features not to be tested
Hardware requirement
Software requirement
Man power requirement
Manual OR automation will be implemented
Build schedule (when the build will be given for testing)
Test schedule (when the testing will be completed for the given build)
When the retesting will be performed
What will be the regression plan
What features will be tested in regression (regression suite) and so on
Scope of testing is defined in test planning
Types of testing like API, compatibility, UI, functional, non functional
Test deliverables
Test artifacts
Test environments
Risk involved
Risk mitigation
Entry criteria
Exit criteria
Responsibilities (roles and responsibilities of each member)
Staffing and training need.

What is Test Strategy?

Test strategy is a set of guidelines or guiding principles to carry out a particular testing task. It is a subset of the test plan. It features preconditions before carrying out a particular testing task.

For e.g. what would be the strategy when a build comes for testing?

1. We might say we’ll be requiring a ‘Release note’ mentioning the features and bug IDs addressed in the build along with other details.

2. Then we must carry out a smoke test on the build to accept it for more rigorous testing.

3. The 70% pass percentage of the smoke test would be the acceptance criteria for the build.

4. Once the build is accepted, the test case execution will begin and

5. The bugs identified will be logged in the respective project management tools.

6. A test summary report will be shared upon completion of testing.

All these low-level guidelines documented is a test strategy document.

While test planning goes hand in hand during the project planning phase and initiation of the project, test strategy on the other hand keeps evolving during the project development process and may change on a conditional basis as per the progress of the project. Test strategy is more of conditional execution of testing task – “if this then that.” The test strategy document contains protocols and instructions which determine the execution of a testing task. There are numerous things that can be strategized in a software test plan. Strategizing automation plan, strategizing stress and load testing plan, Strategizing nonfunctional testing, Strategizing functional testing, and so on.

In some cases, a test strategy is defined in the test plan document itself. But in larger projects where the scope of testing is immense and lots of non-functional testing also needs to be done, in such cases, a separate test strategy document is prepared which list down the approach and guidelines for carrying out the testing.

Common Mistakes In Home Loan EMI Calculations

Home loans are complex yet worthwhile products as they offer you a chance to own your dream home. There are, however, a few mistakes that people make while making their home loan EMI calculations. Understand and avoid the same to make better financial choices.

1. People don’t undertake extensive research.

Any potential borrower can go online and find out important details from reliable third-party websites. Bank websites also promote their own products and services. There are also ample other websites that offer home loan EMI calculators in India . In addition, they also offer sophisticated financial advice on home loan calculations. Availing these services help you to understand the potential expenses that you are normally unaware about.

2. Factor in the minor expenses.

There are several expenses included in the home loan calculations, some of which are trivial and don’t seem to be important enough today. However, they are sizable collectively. Hence, it is important to take them into account from the start. Here are a few examples of such minor yet relevant expenses:

• HLPP
• Stamp duty
• Processing fees
• Additional expenses during the loan term such as prepayment penalties, switching charges

When you use the home loan calculator in India , include these amounts in your principal amount before you calculate your EMI.

3. People rush to seal the deal.

Most borrowers are in a hurry to complete this process. There is nothing wrong with that; however, in a hurry, they tend to ignore important details. Some of these include:

• Credit Score: People understand that their credit score affects the loan in more ways than one. Yet, people don’t take the time to improve it before applying for a loan. This small step is crucial for loan approval and better interest rates.

• Negotiating Interest Rates: You can negotiate the interest rates with the home loan officers. This practice is neither announced nor encouraged. But, people who are patient enough to ask and negotiate can avail it.

• Terms and Conditions: Very few people attempt to understand the terms and conditions for the loan. This document includes quite a few important conditions for the home loan. For example, most people opt for fixed interest rates, assuming they remain unchanged. Yet, the fact is that it is higher than floating interest rates and susceptible to change over a period of time.

Most investors and business owners, who avail home loan services frequently for their businesses, understand these principles and incorporate them. Thus, it is important to examine your loan applications, credit scores, repayment strategies and relations with banking officers to get the best results possible.