Selenium Tutorial

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.

 AspectsBesant Technologies Selenium TutorialsOthers
1.InstructorsA team of industry specialized Selenium professionalsPeople with some technical knowledge without practical experience
2.24/7 AssistanceYesNo
3.Tutorial TimingsFlexibleFixed
4.Study On Your Own ScheduleYesNo
5.Job AssistanceYesNo
6.FocusMaking Skilled ProfessionalsMaking a Profit
7.Certification AssistanceYesNo
8.Project SupportYesNo
9.LMS Access365 DaysLimited

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:

  1. IDE
  2. RC
  3. WebDriver
  4. Grid

Selenium IDE: IDE (Integrated Development Environment)

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

Advantages of IDE:

  1. Recorded script convert into different components and languages.
  2. Default object identification.
  3. Can run test suites periodically.
  4. Record and playback.
  5. Create test cases.
  6. Create test suites.
  7. We can debug test cases.
  8. We can edit test cases.

Disadvantages:

  1. Only supports Firefox.
  2. It supports only page operations.
  3. Limitations in Automation.
  4. It not supports enhance test cases.
  5. We can’t store elements.

Installation IDE:

url: seleniumhq.org

click on downloads button

under selenium IDE click on addons.mozilla.org

once downloaded restart browser.

Selenium RC: RC(Remote Control)

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

Advantages:

  1. It supports multiple languages.
  2. It supports different environment.
  3. 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:

  1. It supports multiple languages.
  2. It supports multiple browser.
  3. It supports third party tools.
  4. It support cross browser testing.
  5. It supports various environments.
  6. It supports web based automation and mobile base automation.

Disadvantages:

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

Downloads required to configure Webdriver:

  1. Jdk
  2. Eclipse
  3. 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

1.Absolute xpath

2.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>

</html>

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: 

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

Syntax:

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?
1.Local Variable
2.Instant variable
3.Class Variable

1.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.

Syntax

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

Syntax:

{
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;

}

VericationCommands:

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 – Chennai & Bangalore Branch Locations

Besant Technologies - Velachery Branch
Plot No. 119, No.8, 11th Main road, Vijaya nagar,
Velachery, Chennai - 600 042
Tamil Nadu, India
Landmark - Reliance Digital Opposite Street
+91-996 252 8294 / 996 252 8293

Besant Technologies - Tambaram Branch
No.2A, 1st Floor, Duraisami Reddy Street,
West Tambaram, Chennai - 600 045
Tamil Nadu, India
Landmark - Near By Passport Seva
+91-996 250 4283

Besant Technologies - OMR Branch
No. 5/318, 2nd Floor, Sri Sowdeswari Nagar,
OMR, Okkiyam Thoraipakkam, Chennai - 600 097
Tamil Nadu, India
Landmark - Behind Okkiyampet Bus Stop,
+91-887 038 4333

Besant Technologies - Porur Branch
No. 180/84, 1st Floor, Karnataka Bank Building
Trunk Road, Porur,
Chennai - 600 116
Tamilnadu, India
Land Mark: Opposite to Gopalakrishna Theatre
+91-755 022 6990

Besant Technologies - Anna Nagar Branch
Plot No:1371, 28th street kambar colony,
I Block, Anna Nagar ,
Chennai - 600 040
Tamil Nadu, India
Landmark - Behind Reliance Fresh
+91-938 404 0493

Besant Technologies - T.Nagar Branch
Old No:146/2- New No: 48,
Habibullah Road,T.Nagar,
Chennai - 600 017
Tamil Nadu, India
Landmark - Opposite to SGS Sabha
+91-984 025 8377

Besant Technologies - Thiruvanmiyur Branch
22/67, 1st Floor,
North mada street, Kamaraj Nagar
Thiruvanmiyur, Chennai 600041
Tamil Nadu, India
Landmark - Above Thiruvanmiyur ICICI Bank
+91-938 404 0493

Besant Technologies - Siruseri Branch
No. 4/76, Ambedkar Street,
OMR Road, Egatoor, Navallur,
Siruseri, Chennai 600130
Tamil Nadu, India
Landmark - Near Navallur Toll Gate, Next to Yamaha Showroom
+91-7338 810 550

Besant Technologies - Maraimalai Nagar Branch
No.37, Ground Floor,
Thiruvalluvar Salai,
Maraimalai Nagar,Chennai 603209
Tamil Nadu, India
Landmark - Near to Maraimalai Nagar Arch
+91-979 123 7373

Besant Technologies - BTM Layout Branch
No 2, Ground floor,
29th Main Road, Kuvempu Nagar,BTM Layout 2nd Coming from Silkboard, take left at AXA company signal,
Stage, Bangalore - 560 076
Karnataka, India
Landmark - Next to OI Play School
+91-762 494 1772 / 74

Besant Technologies - Marathahalli Branch
No. 43/2, 2nd Floor, VMR Arcade,
Varthur Main Road, Silver Springs Layout,
Munnekollal, Marathahalli, Bengaluru - 560037
Karnataka, India
Landmark - Near Kundalahalli Gate Signal
+91-910 812 6341

Besant Technologies - Rajaji Nagar Branch
No. 309/43, JRS Ecstasy, First Floor,
59th Cross, 3rd Block, Bashyam Circle,
Rajaji Nagar, Bangalore - 560 010
Karnataka, India
Landmark - Near Bashyam Circle
+91- 734 916 0004

Besant Technologies - Jaya Nagar Branch
No. 2nd Floor,1575,11th Main Road,
4th T-Block, Pattabhirama Nagar, Jaya Nagar,
Bangalore-560041
karnataka, India
Land Mark: Opposite to Shanthi Nursing Home
+91-733 783 7626

Besant Technologies - Kalyan Nagar Branch
No.513, 4th Cross Rd
2nd Block, HRBR Layout, Kalyan Nagar,
Bangalore-560043
karnataka, India
Land Mark: Opposite to kalayan nagar Axis Bank
+91-938 404 0495

Besant Technologies - Electronic City Branch
No. 7, 3rd Floor, Ganga Enclave,
Neeladri Road, Karuna Nagar, Doddathoguru Village,
Electronics City Phase 1, Electronic City,
Bangalore - 560100, karnataka, India
Land Mark: Adjacent to HDFC Bank and State Bank Of India
+91-782 392 2180

Besant Technologies - Indira Nagar Branch
No.54, 1st Floor,
5th Main kodihalli,
Bengaluru, Karnataka 560008, India
Landmark: Behind Leela Palace Hotel,
+91-910 812 6339

Besant Technologies - HSR Layout Branch
Plot No. 2799 & 2800, 27th Main,
1st Sector, HSR Layout,
Bengaluru, Karnataka 560102, India
+91-733 783 7626