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

Appium and android mobile app automation

Next appium and Android mobile app automation video tutoria l is live. If you are new to appium then please check - appium-tutorial This video tutorial covers - Start vysor (Just for this session and not mobile automation :)) Start appium and start appium inspector Desired Capabilities platformName - Android deviceName - L2N0219828001013 (as seen on "adb devices") Saved Capability Sets Start Session Scan app elements using appium inspector Get appPackage and appActivity using "APK info" app Install "APK info" app and open app whose appPackage and appActivity are required i.e. calculator Check top section of app icon com.android.calculator2 is app package com.android.calculator2.Calculator is app activity testng.xml file settings for running Android app tests Test details com.seleniumtests.tests.mobile.AndroidAppTest and CalculatorScreen class View beautiful STF test report  

Return only first or last element from webelements collection

Note: If you are new to java and selenium then start with selenium java training videos .     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

Using chrome console to test xPath and css selectors

Note: If you are new to java and selenium then start with selenium java training videos .       Since the advent of selenium there have been many plugin to test xPath / css selectors but you don’t need any of them if you have chrome browser. Using Chrome console you can test both xPath and css selectors. Launch website to be tested in chrome browser and hit F-12 and you would see chrome console opened in lower pane of application - Hit escape key and console would open another pane to write element locators - And now you can start writing xPath or css selectors in chrome console and test them - The syntax for writing css id - $$(“ ”) And hit the enter key. If your expression is right then html snippet of the application element corresponding to the css selector would be displayed - If you mouse over the html snippet in chrome console then it would highlight the corresponding element in application - If you want to clean console of previously wri