Skip to main content

Java Centre

If you are new to programming or have least experience with programming then I would recommend you to watch following java training videos first before embarking on learning Selenium.
If you are well versed with java programming language then you can directly move to selenium webdriver training videos
 
Following java training videos are tailored for selenium but they can also be used to learn java (or at least core java in general). The Java projects used in the video tutorials are available on GitHub at javatutorial and on seleniumtests_with_java.

Please don't use these programs to write selenium tests as selenium tests require a robust framework. Once you are skilled at java then may like to try Selenium Tests Automation Framework to write your selenium tests in java.

So bookmark this page to keep track of new videos :-)

So here we go -



Training Video Content

Training Videos

Introduction to java technology


Downloading community version of IDEA


Installing Java


Running your first java program

Beginning with Java





Introduction to Object

Introduction to Class

Inroduction to Inheritance

Introduction to Package

Introduction to selenium API

OOPS and Java





Introduction to Variables

Introduction to Arrays

Control flow statements in java

Java Language Basics








Access specifiers 

Defining methods - instance and class methods

Overloaded methods

Passing variable argument to method

Return value from method

Using this keyword

Static initializer

Java Classes, objects and method






Enum Type - 

   With and without parameter

   Creating Enum in Intellij

Iterating through values of enum

Instance Initialization

Switch Statement 

Enum and switch statement






Interface in java

implementing an interface

Overriding method in interface

Using interface type

Down casting

Selenium examples

Interface and Java






Generics:

  Raw Type 

Generic Type 

Exception:  

Exception Hierarchy - 

Types of exceptions -


Checked Exception 

Unchecked Exception -

Error

RunTimeException 

 

Handling Exception with try - catch - finally block

Specifying the exception

Exception classes in WebDriver

Generics and Exception





The core collection interfaces.

List, Set, Map 

Important collection methods 

Introduction to ArrayList -

Introduction to HashSet -

Introduction to HashMap -

Traversing collection using for each loop and Iterator Object


Introducing java collection framework





Using collection framework with webdriver - 

Array List example 

Set Example

HashMap example

Java Collection framework and Selenium Webdriver




Date and time operations -  

generate time in ms 

calculate time difference between two operations 

creating date instance using java.util.Date 

compare dates, which date is ahead? 

accessing year, month day etc for a given calendar 

generating future/past dates 

formatting date 

a complex example - generating future date for USA time zone

Date and Time operations





File System -  

      retrieving absolute file path

copy file to another file

read txt file

read property file

parsing xml file

Handling files in java





Database operations with java (JDBC) -   

establishing connection   
executing select query
executing update query

JDBC




Dealing with multiple form objects

  • Form with many fields
  • How to not write bloated data objects
  • Builder pattern comes for rescue

how-do-you-deal-with-multiple-form?





IDEA hacks

This session covers -
  • Refactor - > Encapsulate fields
  • Refactor - rename
  • Code generation - > Generate getter, setters, toString, equals etc. Ex
  • Conditional Debug points
  • Cmd + shift +a to search anything
  • Analyze stacktrace

idea-hacks







Intro to java 8 and selenium using java 8

This session covers -
 
  • Why is java 8 so popular?
  • I do not java yet : -/
  • What is FunctionalInterface?
  • Functional programming and Lambda
  • Interface having method with no argument
  • Interface having method with one argument
  • What if AnimalHavingMethodArgument has two abstract methods?
  • And what next? > Future training videos sneak peak using java 8 and selenium?

java-8-intro-and-sneak-peak-into-selenium-using-java8






Java 8 part 2: Stream filter operations and Selenium WebDriver

This session covers -
  • List operations in java 8
    • Using stream with List
    • Filter stream
    • FindFirst
  • Intro to method references
  • Intermediate operations (i.e. filter, map)
  • Terminal operation (forEach, findFirst, reduce, collect)
  • WebDriver and list examples using java 8

java-8-part-2-Stream filter operations and Selenium WebDriver






Java 8 part 3: Stream map operations and Selenium WebDriver

This session covers -
  • Some more gran on lambda
  • Intro. to Stream > map api (Forget about Map api for now :))
  • How lambda returns a value?
  • Using predicate static variable and method references
  • WebDriver and map examples using java 8
  • Debugging map operation on data point

java-8-part-3-map-operations-and-selenium-webdriver







Java 8 part 4: Optional and Selenium WebDriver

This session covers -
  • Java 8 part 4: Optional and Selenium WebDriver (yes learning Optional is not optional :))
  • Why Optional > What happen when data is null
  • Optional > an object which may or may not contain non null values (some prefer to call it empty value)
  • Do you remember where we used Optional?  :) com.seleniumtests.java8.ListExamples class > findFirst()
  • Creating Optional using - of, ofNullable, orElse  
  • WebDriver examples with Optional >    
    • Default locale
    • Testing with different data sets i.e. lower and upper case

java-8-part-4-optional-and-selenium-webdriver








Java 8 part 5: IntStream, sum, avg, reduce, file reading operations and SeleniumWebDriver

This session covers -
  • Method implementation on interface with java 8 - static and default methods, wtf??
  • IntStream.range()
  • More Stream operations -    
    • sum, sort, average
    • And how do I add double numbers?
  • Reading from file
  • Collectors.toMap 
  • Where are the WebDriver examples??

java-8-part-5-intstream-sum-avg-reduce







Java 8 part 6: Stream cont. and Selenium WebDriver

This session covers -
  • Different ways of creating Stream
    • empty stream, stream of collection, stream of string objects, stream builder, stream generate method with limit and iterate
  • Stream of primitives
    • int, long and double streams using IntStream, LongStream, DoubleStream interfaces
  • Stream of File
  • Streams can not be reused
  • How to eliminate expensive operations
  • And what is parallel stream?? 
  • And some WebDriver examples

java-8-part-6-stream-cont-and-selenium-webdriver








Java 8 part 7: Back to basics and Selenium WebDriver

This session covers -

  • PECS > Producer extends Consumer super
  • Remember Generics which provide type safety?: https://www.seleniumtests.com/p/java-training-tutorial-videos.html
  • What are “extends”, “super” and bounded wild card?
  • <? extends T> and <? super T> WTF ??? 
  • map(Function<? super T, ? extends R> mapper) example from com.seleniumtests.tests.web.SeleniumWithJava8Session6#usingJava8
    • forEach(Consumer<? super T> action)
    • PECS on Jav8 > Stream examples -

java-8-part-7-back-to-basics







IDEA Hack 2

This session covers -

  • Presentation assistant plugin
  • Double shift > search any where 
  • Search class name using first letters    
    • Go to specific line on file i.e. filename:linenumber
    • Searching folders i.e. /resources
  • Recent files > cmd+E
  • Project pane > cmd+1
  • Creating new file/package etc > cmd/ctrl + N
  • Auto scroll from source
  • Move one or multiple lines without cut and paste
    • select + option + shift + arrow up/down
  • Turn off presentation assistant plugin

intellij-idea-hack2





REST API Testing

This session covers -

  • REST Assured Maven dependency, 
REST Assured Includes JsonPath and XmlPath  to parse json and xml documents respectively

  • API used in testing: https://reqres.in/ 
Passing parameters between tests using extract method

  • Set base URI
  • With and without Gherkins syntax
  • Data driven test with query, path parameters and Curly bracket notation
  • Operations around Get



Comments

Popular posts from this blog

Verify email confirmation using Selenium

Email confirmation seems to be integral part of any registration process. I came across an application which lets you provide your email address. You can follow the sign up link in you mail and then complete the registration process. Lets consider we provide GMail address for it. Now if were to use only Selenium then we would have to follow following steps - Launch GMail using Selenium; Some how search for new mail in the list of available mails; Some how click on it; Parse the mail message; Get the registration link; Follow up with registration process What do you think of an approach in which you can

Return only first or last element from webelements collection

We often come across situation when there are multiple elements on a page and we probably like to exercise only a few of them using selenium webdriver. May be just first and last element. For example on a search result page we may like to click on only first and last link and not all. This is when Iterables API comes handy. (By the way I am assuming that you have already completed watching selenium training videos :)). Once we have collection of web element then we can use Iterables to get only first or last element as following - Consider that we fetch collection of element as - List< WebElement > webElements = getDriver().findElements(By. id ( "htmlID" ));   Now we can get the first web element from this collection as -  WebElement firstElement = Iterables. getFirst (webElements,  getDriver().findElement(By. id ( "defaultElement" )));   Herein second argument -   (getDriver().findElement(By. id ( "defaultElement" )))    in the me

Using xPath to reach parent of an element

Well, I am big fan of css locator my self there are times when css locators don't fit requirement. One such requirement is when you want to navigate to parent element of an element and may be parent of parent and even more. Unfortunately css locators don't provide any mechanism to navigate to parent of an element. See this for more. Of late I came across a scenario when I wanted to click on a link depending upon the text in a text box. Herein parent of text box and parent of link were at the same location. More over there could have been many such combinations in application. Fortunately I just need to pick first such instance and Web Driver any way considers only first instance when multiple locators are found matching an element. Element in question is in following html - Here I need to click on highlighted anchor on the basis of input element (which is also highlighted in image) Herein first I need to reach div parent (class = 'left couponmainarea