How to teach yourself Selenium

I have been in the field of test automation for now more than a decade, out of which a significant amount of time I spent on learning and implementing open source test automation solutions to different projects and create products around it. I have also been imparting training and consultation over these tools and specially Selenium for quite some time now.  Over past few years, the number of organizations and individuals who provide training and learning resource for Selenium has increased manifolds no wonder as this is the most sought after skill in test automation. Organizations whether small or big, if having a testing team, will be requiring test automation experts and Selenium is one of the most popular skills required.  The question is whether as a manual tester, or someone coming from the development background, could you self learn this tool? The answer is YES.

 Related image

 

If you are a Manual Tester

If you are a manual tester, and have decided to take the plunge into test automation, the first step you need to do is teach yourself some programming. Picking a scripting language is always easier than picking a programming language. And if I may suggest, start with learning Ruby. Not only you will fall in love with programming, but you will find immense power when you see your scripts running. To learn Ruby, start here – http://rubylearning.com/satishtalim/tutorial.html

After you have made yourself familiar with Ruby, teach yourself some Java. To learn java and its concepts start here – http://docs.oracle.com/javase/tutorial/

Here’s a checklist to follow when you are teaching yourself programming –

  1.          A Program consist of two parts – Logic and Syntax. Logic doesn’t changes from one programming language to another. But Syntax will change from one language to another. So for initial few days as you learn about the variables, if conditions, loops spend good amount of time in logic building. 
  2.          Learn what are the different types of data are there and how to define them
  3.          Learn how to define the condition statement – If and Switch and the looping statements – while and For. 
  4.          Learn how to define collections like Arrays, Hashes in that programming language
  5.          Spend good amount of time in learning String handling, and their inbuilt methods.
  6.           Learn how to read and write text files
  7.          Learn about regular expression in that programming language
  8.       Learn about a very important concept and spend most time here – Object Oriented Programming- Class, Objects, Inheritance, Interfaces, Abstract etc
  9.       Learn about how in that language we can handle exceptions
  10.       Learn about the different types of errors that can come up and how to find workaround for them. 

If you are a Developer

If you are a developer, you are already aware of programming language. But you should make yourself aware of the manual testing concepts. You should know what is a test case, and its components. The test steps, validations, test data etc. We should understand about a bug life cycle, and the concept of regression testing. When we look at the document of test cases, we should be able to identify the candidates for test automation amongst them, which would the ones which are repeated or data driven.

To understand more about manual testing concepts, start here – 

https://www.guru99.com/manual-testing.html

and - http://www.softwaretestinghelp.com/manual-testing-tutorial-1/

 Once as a manual tester, and developer you are on the same page, lets understand how to approach learning Selenium

Learn Selenium

Selenium is an open source test automation tool, to test web applications. The main website of Selenium is - http://www.seleniumhq.org/.  Go through this website and read about the four important components of Selenium – IDE, RC, WebDriver and Grid. http://www.seleniumhq.org/projects/

Out of these components, the first component we start learning is Selenium IDE, and after that we move towards learning the WebDriver. Selenium IDE is just a record and playback api which works only with the firefox browser. The idea to learn Selenium IDE is to let it act as a ice breaker, and teach ourselves some important concept of Selenium commands and Locators. From IDE we want to learn –

Commands in Selenium

Locators in Selenium – For knowing more about locators in Selenium read the following links –

http://www.seleniumhq.org/docs/02_selenium_ide.jsp#locating-elements

http://5elementslearning.com/moredetail.php?d=MjY=

http://5elementslearning.com/moredetail.php?d=Mjc=

The concept of locators in Selenium if of utmost importance, and learning this concept using selenium ide is most helpful. To understand xpath, take help of firebug and firepath. Also at this point it is important that we understand about the different web technologies which as automation testers we should be aware of –

HTML- https://www.w3schools.com/html/

XML and XPATH

https://www.w3schools.com/xml/

https://www.w3schools.com/xml/xml_xpath.asp

https://www.w3schools.com/xml/xpath_axes.asp

CSS- https://www.w3schools.com/css/

DOM- https://www.w3schools.com/jsref/dom_obj_document.asp

A complete video tutorial about Selenium IDE is available here - https://www.youtube.com/watch?v=4kgbUzjaox0&t=6s

 

Approach to Learning Selenium WebDriver

Once you have made yourself comfortable in Selenium IDE, you should approach learning about Selenium Webdriver. To start with you should go through these documents and make yourself aware about the Driver object and its methods, the Webelement object and its methods and the By class and its methods.

Links - https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/WebDriver.html

https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/WebElement.html

https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/By.html

The driver object refers to the browser, the webelement talks about the different html elements and what kind of actions can be done on them, and the By class talks about locating those elements using properties like id, name, xpath, css, or dom.

We them move on to learning two important concept of automation – Parameterization and Synchronization – 

http://5elementslearning.com/moredetail.php?d=MTY=

http://5elementslearning.com/moredetail.php?d=Mjg=

 Once you have made yourself familiar with above topics, learn about the concept of Page Object Model - http://5elementslearning.com/moredetail.php?d=MjQ=, a video tutorial on it is available here - https://www.youtube.com/watch?v=f7SgpjGVd2s

 

Conclusion and Learning Ahead

By going through the above topics in the flow mentioned you should be able to teach yourself good selenium concepts, which you can then test using a website. An example website for testing is available here - http://5elementslearning.com/demosite/.  Create flows and automate them using the concepts learnt above. To simplify pick any one scenario and learn all concepts around it. Further you should make yourself learn about frameworks in Selenium- https://www.youtube.com/watch?v=QRyEWS-doGQ

And how you can use Selenium Grid, how you can use Selenium with Cucumber, Maven, Jenkins and protractor, sikuli, auto it to handle alerts etc. But before you move on to these advance topics it is important that you are well aware of how selenium works, and how webdriver works with different browsers, and where does in all this a programming language fit in.

Some of the other wonderful blogs you should consider visiting-

http://toolsqa.com/

http://learn-automation.com/

http://www.softwaretestinghelp.com/selenium-tutorial-1/

https://www.guru99.com/selenium-tutorial.html

http://courses.helpingtesters.com/p/selenium-webdriver-online-training

 

Happy learning!