Wednesday 9 September 2015

Introduction to Selenium WebDriver

When one starts with new technology, there are numerous questions clouds in a mind. Selenium is not an exception. As a beginner or newbie, you might have following questions which I had some months ago. So I have created a list of all those questions. I will try to answer those questions as per my knowledge and understanding.

  • What is selenium?  

  • Why we need Selenium?

  • What are advantages of selenium over other tools?

  • Is Selenium WebDriver best tool available out there for automation?

  • Why should one learn Selenium WebDriver?

  • How to learn Selenium WebDriver?

  • Where can I find free online step by step tutorial to learn Selenium?

  • How can I enhance my selenium skills?


Answers to most of these questions mentioned above are related to each other. Let’s go one by one.

What is Selenium?

          As per official Selenium website, Selenium automates browsers. Citing the entire introductory a paragraph from the source:

Selenium automates browsers. That's it! What you do with that power is entirely up to you. Primarily, it is for automating web applications for testing purposes, but is certainly not limited to just that. Boring web-based administration tasks can (and should!) also be automated as well.
Simon Stewart, creator of WebDriver has put it down very nicely in a ‘The Architecture of Open Source Applications - Selenium WebDriver’. Citing the entire introductory a paragraph from the source:

Selenium is a browser automation tool, commonly used for writing end-to-end tests of web applications. A browser automation tool does exactly what you would expect: automate the control of a browser so that repetitive tasks can be automated.
Both sources have explained selenium in layman term, you get the idea now what Selenium is. If you are looking for the technical answer, please check this post.


Why we need Selenium WebDriver?

         If someone asks you question why we need Selenium, what would be the answer? Answer is very simple because we need to automate the Browser due to following reasons:-

  1. Doing Regression Testing frequently takes a lot of human efforts and time.
  2. Manual Testing is prone to error.

       Thus automation is reliable, repeatable way than we could do with people. It may save time and/or save money, although if it is done in the wrong way or in the wrong circumstances, it may require even more time and more money than using people.
 

What are advantages of selenium over other tools?

  1. Selenium WebDriver is part of W3C’s Web Testing Activity Statement. WebDriver is a standard which means it is not going anywhere which may be the case for vendor specific tool.
  2. No upfront cost, free to download.
  3. Community-based but great support.
  4. A lot of free resources available for learning Selenium WebDriver.
  5. Option to choose a programming language.


Is Selenium WebDriver best tool available out there for automation?

          If someone tells you that any specific tool or technology is best, never trust them. It would be always context driven. What may be best in one context can be bad in another context. 
         Selenium is no exception either. The truth is newbie or beginner cannot write great maintainable robust code at first, of course, they can follow the learn-practice-improve cycle and Selenium WebDriver needs expertise in a programming language. Apart from that like many other commercial tools, there is no great reporting system in Selenium WebDriver. You can use third party library like ExtentReport or Allure Report to overcome that but still. Selenium Webdriver only works for browser-based testing and NOT FOR DESKTOP BASED TESTING.


Why should one learn Selenium WebDriver?

    Read all the advantages of Selenium WebDriver in above section, those are enough reasons to learn the Selenium WebDriver. Apart from that plenty of decent paying job available and a trend is going up.

Selenium and WebDriver Job Trends
Selenium and WebDriver Job Trends


How to learn Selenium WebDriver?

        Like any other technology/programming language, you have to try it for yourself. Just reading would never take you to anywhere. You actually would have to download the IDE and start coding and using Selenium WebDriver.

Where can I find free online step by step tutorial to learn Selenium WebDriver?

         There are plenty of good free tutorials available online for Selenium WebDriver. You just need to google it out. You can find related tutorial on this blog as well but I would suggest following more than one blog to broaden your knowledge and skills.

How can I enhance my selenium skills?

          If you already good at Selenium WebDriver and you think your learning curve is pretty stagnant now, then please check this post.


This is all for now.
Cheers!!

Share:

Creating your first project in IntelliJ Community Edition IDE

In previous post we have covered, how to install the IDE. Now we will see how to create to java project in IntelliJ IDE which would be required for our first selenium script.


Just follow below steps and images -
Open the IDE.
Open the IDE.
Open the IDE.


As we are starting fresh, we don't have any settings to import so we will select the second radio button and click on OK button
Setting import pop up
Setting import pop up


We need to accept the privacy policy agreement before proceeding any further. Read the policy and then click on accept.
Privacy Policy Agreement
Privacy Policy Agreement


For now, we would not make any change in default setting of IntelliJ be it theme or any plugin. If you want to play around with it, go ahead no harm in that.


Default setting for IDE
Default setting for IDE
Now IDE will get loaded as shown in below image.


IDE getting started
IDE getting started


Click on first option to create your first project.
Create New Project
Create New Project


We need to set SDK for this project, so click on New button.
Set SDK for the project
Set SDK for the project
Click on JDK option from the list.


Set SDK for the project
Set SDK for the project


Set JDK path as shown in image below. If you have not installed JDK, then please follow the instruction mentioned in this post. It will help you to download and install JDK.


Set JDK for the project
Set JDK for the project
JDK path will reflect in SDK
Project SDK
Project SDK


Next to continue
Next to continue


Name your project and select the location for the project then create on Finish button.


Project Name & Location
Project Name & Location
IDE will give you interesting Tip of the day, for now we will just close it.
Tip of the Day
Tip of the Day
Click on the nodes to see your first project.
First Project
First Project


Congratulations! You have created your first project successfully.
Share:

Installation Of IntelliJ Community Edition

        This post is about Integrated development environment commonly known as IDE. Choosing IDE is a personal thing and like all the personal traits, this also counts and counts a lot in your productivity.
        When I started with learning automation using selenium, I did extensive research. Right from the book which I should read, blogs which I should follow and IDE which I should use.
         I chose IntelliJ Community edition Over Eclipse IDE. Though Eclipse is the top ranked IDE used in the automation industry, I didn’t just blindly followed the community. I downloaded both the IDE and tried them each for a week. I found myself at ease when I was evaluating Intellij, and it was mainly because it gives the ability to debug in the same view, unlike Eclipse. Here are the pointers that can help you to choose between IDE




Downloading IntelliJ Community Edition :-
  1. Go to JetBrains website, Visit Intellij Idea page.
  2. Click On Download Button.

Intellij Community Edition Download
Intellij Community Edition Download


3. IDE will start downloading.
Intellij Community Edition Downloading Started
Intellij Community Edition Downloading Started


Installing IntelliJ Community Edition:-
Click On installable file and then just follow along as shown in below images.


Intellij IDE installable.png
Intellij IDE installable


IDE installation part 1
IDE installation part 1


IDE Installation step 2
IDE Installation step 2



IDE Installation step 3
IIDE Installation step 3


IDE Installation step 4
IDE Installation step 4
IDE Installation step 5
IDE Installation step 5


IDE Installation step 6
IDE Installation step 6


Congratulations!! You have successfully installed IntelliJ Community Edition


Share:

How to check whether my PC is 32 bit or 64 bit?

1. Press Windows Key from Keyboard Windows key iocn
                           OR
                Click on Start icon
                                   start icon


       2. Right click on Computer.
               Right Click on Computer
3. Click on Properties.
4. Check System type How to check whether PC is 32 bit or 64 bit2.png


I’m running 64-bit version of windows 7.

         


                                                            

Share:

Installation of java & Set environment variables for java installation

We can divide this post in 3 parts:-
  • Java Installation
  • Setting up environment variables for java installation
  • Verify Java installation and newly set up environment variables are proper.


Java Installation:-

  1. Go to Java download page.
  2. Check whether your PC is 32 bit or 64 bit.  I’m running 64-bit version of windows 7.
  3. Click on Accept License Agreement radio button after reading License agreement.
Java Download page
Java Download page
4. For 32 bit Operating System [OS], click on jdk-8u77-windows-i586.exe and for 64 bit Operating System [OS], click on jdk-8u77-windows-x64.exe


5. Your download will start after clicking on link
download starts.png
Java downloading on local machine

6. I have already downloaded JDK [Java Development Kit] version - jdk-8u77.
.
JDK installable.png
Java Installable
7.   Now double click on your java installable. Follow with images below:-
JDK Installation step 1
JDK Installation step 1


JDK Installation step 2
JDK Installation step 2

            Please note the highlighted path, we would be using this path to set a environment variable.
          
JDK Installation step 3
JDK Installation step 3


JDK Installation step 4
JDK Installation step 4
                    JRE is getting installed.


JDK Installation step 5
JDK Installation step 5


JDK Installation step 6
JDK Installation step 6
Please note that - Both JRE & JDK got installed using same installable.
.


Setting up environment variables for java installation-

 We would be setting below two environment variables -
  • JAVA_HOME : C:\Program Files\Java\jdk1.8.0_25
  • PATH      : ;%JAVA_HOME%\bin;
Follow along the images to set environment variables.
1. Press Windows Key from Keyboard Windows key iocn
                          OR
               Click on Start icon
start icon
windows start icon
                                  


Way to set up environment variable
Way to set up environment variable 
2.  Right click on Computer.
3. Click on Properties
Way to set up environment variable
Way to set up environment variable
Way to set up environment variable
Way to set up environment variable
You can also open above window directly using [rundll32.exe sysdm.cpl,EditEnvironmentVariables] .

  • Open Run Prompt [Win key +R]
  • Type rundll32.exe sysdm.cpl,EditEnvironmentVariables
  • Hit Enter key


Way to set up environment variable
Way to set up environment variable 
Setting up JAVA_HOME
Setting up JAVA_HOME


Entry of JAVA_HOME
Entry of JAVA_HOME


Updating Path Variable
Updating Path Variable


Updating Path Variable
Updating Path Variable

There is a blogpost explaining the rationale behind all these environment variables.


Verify Java installation and newly set up environment variables are proper.



Open Command prompt [Press Win key + R]
Type cmd and hit enter.
Run Prompt
Run Prompt
Command Prompt will be open


Command Prompt
Command Prompt


Type java -version and hit enter.
Command prompt should display newly installed java version.
Verify Java Version in command prompt
Verify Java Version in command prompt




Share:
Copyrights held by Amol Chavan. Powered by Blogger.