Our Special Offer - Get 3 Courses at 24,999/- Only. Read more
Hire Talent (HR):+91-9707 240 250

Selenium Tutorial

Selenium Video Tutorials | Learn Selenium in 3 Hours | Must Watch it!

Selenium Tutorials

Are you one of those IT developers who feel stuck in the job and can’t see any more growth scope? Or are you an IT employee looking for a better pay package? Or a promotion maybe? Well, your search ends here, Selenium is your savior. Besant Technologies brings to you its world-class Selenium tutorial package, made to help you achieve all your ambition. These tutorial series have been well thought of and designed keeping in mind its implementation techniques from both bits of knowledge as well as practicality point of view. Enroll today to make better use of your valuable time!

What is Selenium?

Selenium in simple words is a Web Automation Software. It is actually an amalgamation of several tools that render different services. It is primarily an automation software but also excels as an automated web testing tool. These types of software suits were made to minimize user intervention in the examination of a website to streamline its proceedings. Selenium is one of the most preferred web automation suites and is backed by Google and several large firms.

What is the main Purpose of Selenium Tutorials?

Selenium Webdriver is open source Application Programming Interface (APIs) or a collection of libraries which work with a web application. What it does is that it automates these browsers and checks whether all the functions of the browser are running as expected. This also includes background processes.

Selenium Tools are designed to test online browser elements, it cannot perform tests on windows based applications. Selenium has different components that take up different roles, take a look at their functions:

  • Selenium IDE (Integrated Developments Environment) – This Selenium component is used to record, edit and debug functional tests carried out on integrated browsers such as Chrome and Firefox.
  • Selenium Client API (Application Programming Interface) – Selenium has its own language (Selenese) to write the tests. However, it is not compulsory to know it, you can also write the test in other computer programming languages such as Python, C#, and JavaScript. Selenium API helps communicate these languages with Selenium.
  • Selenium RC (Remote Control) – These are servers, which runs browser using HTTP commands.
  • Selenium Webdriver – A forerunner to the Selenium RC, Selenium Webdriver simulates the browser on which it is installed.
  • Selenium Grid – This component allows testing of Webdriver nodes that are running on remote machines.

Why Selenium Tutorials is so Important?

Learning how to use Selenium, itself opens up a number of lucrative careers, Automating Testing Professional being one of them. When you already are a successful IT professional, understanding of Selenium boosts your value and the company will consider you as an asset. All of this contributes to the popularity and demand of Selenium Testers. This is because, unlike other commercial testing suites, Selenium has a lot more to offer. Some of the key benefits of using Selenium are:

  • It is open source and has free support of a skilled open community backed by Google.
  • The software suite is compatible with several browsers, such as Mozilla Firefox, Google Chrome, and Safari.
  • No Operating System demands as it runs on almost all of them including LINUX.
  • Supports several programming languages.
  • There are hundreds of frameworks or templates available for you to choose from.
  • Easily integrates with other tools such as TestNG, Maven etc.
  • Tests can be run simultaneously on several machines and browsers.

As you can see, it is only a matter of fact that the demand for Selenium testers are huge. So join our Selenium course today!

What is the difference between Other tutorials and ours?

Now, this can be settled using a simple table that will show you the absolute benefits of our tutorial course.

  Aspects Besant Technologies Selenium Tutorials Others
1. Instructors A team of industry specialized Selenium professionals People with some technical knowledge without practical experience
2. 24/7 Assistance Yes No
3. Tutorial Timings Flexible Fixed
4. Study On Your Own Schedule Yes No
5. Job Assistance Yes No
6. Focus Making Skilled Professionals Making a Profit
7. Certification Assistance Yes No
8. Project Support Yes No
9. LMS Access 365 Days Limited

At Besant Technologies we value your presence and understand your needs and time constraints. When you choose us you choose to trust us and that is very important for us. We make sure that we uphold your confidence and faith and provide you exactly what you paid for.

How Selenium Video Tutorials will help Students?

The benefits of Selenium video tutorials are manifold. Some of them are mentioned below, take a look.

  • Video Tutorials of several Selenium teachings will help solidify the concepts and build an audio-visual memory of the teachings.
  • It will help understand practical concepts much faster.
  • It will make e-learning more engaging and will maximize the retention of basic concepts regarding Selenium.
  • Video tutorials are cost-effective and reduce traveling expense.
  • Several tutorials will create a face-to-face learning atmosphere.
  • A lot of complex concepts can be understood in a much simple way using Selenium video tutorials.
  • No fixed time commitement to complete a tutorial.
  • Easy access to the material, because you can even view the videos on your phone.

The videos provide a consistent experience, like watching a TV series.

Our Selenium tutorial introduces the reader informally to the basic concepts and features of the Selenium. We hope these Selenium Tutorials are useful and will help you to get the best job in the industry. These Selenium Tutorials are prepared by Selenium Professionals based on MNC Companies expectation. Stay tuned we will update New Selenium Tutorials Frequently. If you want to learn Practical Selenium Training then please go through this Selenium Training in ChennaiSelenium Training in Bangalore, and Selenium Training in Pune.

What is Testing?

Testing is a process of checking whether developed application is working as per customer business requirements or not, and also finding defects.

Automation: Making Testing process Automated using tools like Selenium or UFT or loadrunner etc is called Automation testing.

Why Automation: Faster than manual testing in execution. Code must be reusability and repeated.

Automation Life Cycle:

  • POC
  • Tool selection criteria
  • Automation scenario identification
  • frame work identification
  • basic script writing
  • Enhance Scripting
  • Debugging
  • Execution
  • Result analyze
  • Defect reporting

What is Selenium Framework?

Selenium is Web interface Automation framework. It automates browser components. When we are getting challenges in manual testing like repeated tasks we will move for selenium. In manual test cases we can convert into Automation Test Cases. It’s support multiple languages like java,C#,Ruby,Perl and Python and also supports multiple browsers.

History of Selenium:

Selenium was invented by Jason Huggins and his team in 2004. In that days the other famous testing tool is Mercury, now present as UFT.

Meaning of mercury is poison, for poison anti dose is Selenium so they put name as Selenium.

Advantages of Selenium:

  1. Selenium supports web based and mobile Automation.
  2. Selenium is an open source tool.
  3. It will supports Multiple Languages
  4. Selenium supports cross browser testing (chrome,safari,IE,firefox….).
  5. Selenium supports third party tools.
  6. Selenium is a user friendly tool.
  7. Selenium supports different operating systems like Windows, MacOS, Linux, etc.

Selenium Components:

It has generally 4 components. Each component had different approach to automate.They are:

  • IDE
  • RC
  • WebDriver
  • Grid

Selenium IDE: IDE (Integrated Development Environment)

  • It is a firefox plugin.
  • It supports record and playback.
  • It supports only user interface components in selenium (like page,visible components).
  • Only component support base state application Automation.
  • It assist in exploratory testing.

Advantages of IDE:

  • Recorded script convert into different components and languages.
  • Default object identification.
  • Can run test suites periodically.
  • Record and playback.
  • Create test cases.
  • Create test suites.
  • We can debug test cases.
  • We can edit test cases.

Disadvantages:

  • It only supports Firefox.
  • It supports only page operations.
  • Limitations in Automation.
  • It not supports enhance test cases.
  • We can’t store elements.

Installation IDE:

  1. url: seleniumhq.org
  2. click on downloads button
  3. under selenium IDE click on addons.mozilla.org
  4. once downloaded restart browser.

Selenium RC: RC(Remote Control)

  • RC is a server based API(Application Programming Interface) command to interact with interface browser.
  • Here server play key role to launch browser to kill browser.
  • It is not a user interface.

Advantages:

  • It supports multiple languages.
  • It supports different environment.
  • It supports multiple browser.

WebDriver:

To overcome facing RC problems we move to WebDriver. It is a programming interface, to create and execute test cases.Test engineer writes the Automation code, that code send to the browser driver components, the browser component executes the tester request, it sends its own request to the browser, the browser then executes the browser driver request.

Here using element locators we can create test cases and execute test cases.

Advantages:

  • It supports multiple languages.
  • It supports multiple browser.
  • It supports third party tools.
  • It support cross browser testing.
  • It supports various environments.
  • It supports web based automation and mobile base automation.

Disadvantages:

  • It not generate detailed test reports, it generates only test summary report.
  • It is not having any default repository.
  • It doesn’t support desktop applications.

Downloads required to configure Webdriver:

  • Jdk
  • Eclipse
  • Webdriver API.
  1. JDK download:

Make sure before downloading jdk we want to identify system bit size.

  urlwww.oracle.com

Go to www.oracle.com à Click on downloads—à click on Accept license Agreements-àselect your platform and bit size.

  1. Eclipse:

  url: www.eclipse.org 

Go to www.eclips.org —à Click on downloads—à under releases click on any version-: select your platform and bit size-: click on save file.

  1. WebDriver API:

url: www.seleniumhq.org

Go to www.seleniumhq.org: Go to previous releases: download any version: selenium

Selenium Grid

Selenium Grid is used to execute test cases in multiple browsers, multiple environment and multiple systems in parallel. Grid is not support to create test cases.

It supports parallel execution in dual environment. Here we can execute webdriver test cases and also RC test cases.

WebDriver

Test engineer writes the Automation code, that code send to the browser driver components, the browser component executes the tester request, it sends its own request to the browser, the browser then executes the browser driver request.

Locators in WebDriver:

Locators used to recognize object in web page.

  • id
  • name
  • classname
  • css selector
  • xpath:Xpath is unique locater in selenium to recognize object based on tagname.
  • LinkText: link having some outer text ie., linktext.
  • PartialLinktext: link text with unique characters.
  • TagName: tagName generally we use for to identify group of objects.

Examples

Id:driver.findElement(By.Id(“Id value”));

Name:driver.findElement(By.Name(“Name value”));

LinkText:driver.findElement(By.LinkText(“LinkText value”));

PartialLinkText:driver.findElement(By.PartialLinkText(“PartialLinkText Value”));

TagName: driver.findElement(By.TagName(“tagName value”));

 

CSS Selector:

  • Developers use css to apply styles on webpage.
  • Tester use css Selector to recognize objects in webpage.
  • CSS Selector is a global locator useful to recognize object with vast combinations.

CSS syntaxes

driver.findElement(by.cssSelector(“#id”)); driver.findElement(by.cssSelector(“.class”));

driver.findElement(by.cssSelector(“tagname#id”)); driver.findElement(by.cssSelector(“Tagname#id.className”));

driver.findElement(by.cssSelector(“[property=’property value’]”));

driver.findElement(by.cssSelector(“[property=’propertyvalue’][property=’property value’]…..”));

driver.findElement(by.cssSelector(“[property=’property value’]>childposition>………”));

 

Xpath:

Xpath is a unique locator builder in selenium. Based on html tag position xpath target object location….

To generate xpath we follow firepath:

Firepath is a plugin for firefox

Installation of firepath:

  • In google search Firepath for Firefox
  • Click primary link
  • Click on add to firefox
  • Click allow to install plugin
  • Click on install now
  • Restart browser
  • After installation firepath display in firebug window at the same time in contextmenu (do right click on page) option also it display.

Xpath available in two types

  • Absolute xpath
  • Relative xpath

Absolute Xpath:

It is useful to target object using tagname position. Generally we follows when object properties dynamically changing but object position static in page.

Syntax for absolute xpath:

-: /html/body/child tagname…..(/tagname/tagname/tagname….)

Navigation to select Absolute xpath:-:

Open firebug window—: Open firepath List> in firepath list Select generate absolute path

 

Html source: to generate absolute xpath

<html>

<body>

<div class=”x”>

<div id=”elugu”>

<div class=”manojkumar”>

<input id=”elugumanojkumar” class=”login” type=”text”>

</div>

<div class=”a”>

<input manoj=”pwd” class=”login” type=”text”>

</div>

</div>

<div id=”button”>

<button id=”signin”  class=”login” type=”submit”>

</div>

</div>

</body>

Absolute xpath:—–:

Username      :-:   /html/body/div/div[1]/div[1]/input

password      :-:   /html/body/div/div[1]/div[2]/input

SigninButton   :-:   /html/body/div/div[2]/button

Xpath position:–:

username      :-:    //div[1]/input

password       :-:   //div[2]/input

SigninButton   :-:   //div[2]/button

—-: >>>

Relative xpath: -:

Relative xpath is useful to target object using Attribute names. We use relative xpath when object dynamically changing its position with in page.

Navigation to Select Relative xpath:–:

Open firebug window—: Open firepath List-: in firepath list uncheck generate absolute xpath.

Syntax for relative xpath

driver.findElement(by.xpath(“.//tagname[@property=’property value’]”))

driver.findElement(by.xpath(“.//*[@locator=’locator value’]”))

driver.findElement(by.xpath(“//tagname[@property=’propertyvalue’]//tagname[@prope          rty=’property value’]…..”))

driver.findElement(by.xpath(“//tagname[atribute=’atribute value’]”))

driver.findElement(by.xpath(“//tagname[contains(@property=’property value’)]”))

driver.findElement(by.xpath(“//tagname[contains(@property=’propertyvalue’)]          [position()=’position number’]”))

driver.findElement(by.xpath(“//tagname[starts-with(@property,’property value’)]”))

driver.findElement(by.xpath(“//tagname[ends-with(@property,’property value’)]”))

driver.findElement(by.xpath(“//*[contains(text(),’visible text’)]”))

driver.findElement(by.xpath(“//*[contains(.,’visible text’)]”))

//[@property=’property value’][property=’property value’]…….

: Current node

// : Current node

: rote node

.. : rote node

: All Attributes (All object properties)

[] : braces use to target single attribute

: Attribute

id : unique id name need to specify in single codes

 

How to work with webElements

Text boxes: driver.findElement(by.locator(“locator value”)).sendkeys(“Elugu Manojkumar”);

Links:driver.findElement(by.locator(“locator value”)).click();

Button:driver.findElement(by.locator(“locator value”)).click():

Radio buttons: driver.findElement(by.locator(“locator value”)).click():

Checkboxes: driver.findElement(by.locator(“locator value”)).click():

 

Create WebElement:

WebElement object=driver.findElement(by.locator(“locator value”));

DropDown: 

Syntax

Select obj=new Select(WebElement);

obj.SelectbyIndex();

obj.selectbyVisibleText(“”);

obj.SelectbyValue(“”);

Working with Selenium Beta Version:-:

url:-: https://github.com/mozilla/geckodriver/releases

navigation-: >>go to https://github.com/mozilla/geckodriver/releases : go to downloads -: under third party drivers,buinds and plugins click on mozilla Gecodriver-:

–: select ur bit zize-: click on save file

System.setProperty(“webdriver.gecko.driver”, “folder path\\geckodriver.exe”);

WebDriver driver=new FirefoxDriver();

Working with Group of objects

With dropdown:

Target  Dropdown:

WebElement obj=driver.findElement(By.locator(“locator value”));

Select obj1=new Select(obj);

List<WebElement> All_options=obj1.getOptions();

//Apply for loop to iterate

for (int i = 0; i < All_options.size(); i++)

{

All_options.get(i).click();

}

Group of Elements:-:

//Find Group elements using tagname

List<WebElement> All_pageElements=driver.findElements(By.tagName(“tagname value”));

int count=All_pageElements.size();

System.out.println(linkscount);

Essiential Java Concepts for Selenium Automation .Mostly 90% of Selenium Testing done by Java Programming.

Class :
Class a blueprint or template where it consist of set of objects, methods, Variables.

Syntax:

class Mobiles
{

}

Method:

Method Define object and class behaviour and state.Methods can create under class only.

Syntax

class Human
{
void Head()
{

}

void Hands()
{

}

}

Variable:

Variable is temporary location to store value .In Variable information can be stored according to data types only.

Datatypes:

Same as other programming languages Java also allow datatype to store values. Datatype define what value to store into variable.

Primitives data types:

  • byte
  • short
  • int
  • char
  • boolean
  • double
  • float

Byte:—> 8 bit

Byte is a integer data type
It allow max value 127
It allow min value -127

byte days=127;

Short:—>16 bit

Short is a integer datatype
shot sal=1000;

int:—->32 bit
int is a integer data types
int phone_number=1234679;

long:—->64 bit
long is a integer datatype
long amount=127686868698;

char:—> single character with in single codes
char group=’A’;

boolean:–> Boolean return true or false
boolean objecexsit=false;

How to store value in non primitive data type:

Syntax to store String values

String email=”besanttech@gmail.com”;
String name=”besant”;

What types of variables available in Java?

  • Local Variable
  • Instant variable
  • Class Variable

Local Variable

These variables defined inside method, it can’t share information to other methods also other classes When method closed data will be erased.

Syntax

public Phone
{

void Landphones()
{
int price=100;
system.out.println(price);
}

void mobile()
{

system.out.println(price);
//Here above method do not allow to print price

}

}

Syntax:Real Application (Local Variable)

public Elugu_Manojkumar
{

void launchApplication()
{

WebDriver driver=new firefoxDriver();
driver.get(“http://hotmail.com”);
driver.manage().window().maximize();

}

void signin()
{

//WebDriver method we can access because
we define webdriver interface locally

}

}

Instant Variable:

Instant Variable Define Inside the class but outside the method , these variable can access across method, and classes.

public Phone
{
public int price=100;

void Landphones()
{
system.out.println(price);
//Variable information can be used
}

void mobile()
{

system.out.println(price);
//Variable Information can be used
}
}

Syntax: Real Application (Instant Variable Example)

public Hotmailhomepage
{
public WebDriver driver;

void launchApplication()
{

driver=new firefoxDriver();
driver.get(“http://elugumanojkumar.com”);
driver.manage().window().maximize();

}

void signin()
{
//webdriver controls we receive because
//Webdriver class initiated as global

driver.findElement(By.locator(“locator value”));
driver.getTitle();
}

}

Static Variable:

These variable define inside the class, outside method same as instant variable only difference class variable define along with Static Keyword.public Phone

{
public static int price=100;
void Landphones
{
system.out.println(price);
//Variable information can be used
}

void mobile
{

system.out.println(price);
//Variable Information can be used
}
}

Inheritance:

Inheritance extends class information to another class,parent class to child class.

Syntax

class A class B extends A class C extends B
{ { {

} { {

passing parameter throw method———>>>

class A
{void static method1(String name)
{
s.o.p(name);
}

public static void main(String args[])
{

method1(“elugu”);
method1(“em”);

}}

Methods:

Method describe Class behaviour and state, with in class we can maintain multiple methods and multiple method types.

VOID

public void m1()
{
//It does not return value
}

String

public String m2()
{

return “Elugu Manojkumar”;
}

Int

public int m3()
{

return 100;
}

boolean

public boolean m4()
{

return true;

}

Verification Commands:

verification commands helps to capture application original behaviour During Runtime[Browser Running time]. After capture original behaviour we validate with expected behaviour to get test case result pass or fail.

list of verification-commands on Page

  • getTitle
  • getCurrentUrl
  • getpageSource
  • getwindowhandle
  • getwindowhandles

list of verification-commands on Element

  • getText
  • getAttribute
  • getcssvalue
  • getlocation
  • getsize
  • getTagname

How to capture current title of the page?.

getTitle() – getTitle method return current page title.

Syntax

String pagetitle=driver.getTitle();
system.out.println(pagetitle);

How to Capture current page url ?

getcurrenturl()

this method return url of current page

Syntax

String pageurl=driver.getCurrentUrl();
system.out.println(pageurl);

getpagesource()

this method return current page source

String pagesource=driver.getPagesource();
system.out.println(pagesource);

gettext()
using this method we can capture any visible text available on target,

Capture Visible Text Available on single target:
WebElement element=driver.findElement(By.locator(“locator value”));
String elementtext=element.gettext();
system.out.println(elementtext);

Capture Visible text available in Page:

WebElement pagetext=driver.findElement(By.tagName(“body”));
String text=pagetext.getText();
System.out.println(text);

getAttribute()

using this method on selected target we can get attribute values
using their names

<a id=”Elugu” class=”Manojkumar” href=”Error! Hyperlink reference not valid.

WebElement element=driver.findElement(by.id(idname));

element.getAttribute(id);
element.getAttribute(class);
element.getAttribute(href);
element.gettext();
Besant Technologies WhatsApp