Introduction to OOP'S Concept in Selenium

Ratings:
(4)
Views:0
Banner-Img
  • Share this blog:

OOPS concepts:-[object oriented program]

It is having below concepts

1) class & objects

2) encapsulation

3) inheritance

4) polymorphism

5) abstraction

These are requested table concepts.

How to develop scripts to a project:-

Package –project-Spicejet

Class      - module    -book a flight

Class    -reasonable methods –objects (I,e url,login,logout)

Inheritance:

2The process of extending [reversing]the public objects from the parent class to child class is known as “inheritance”.

2From, where we are taking the public objects, is known as parent class or super class.

2where we are going to use the public objects is known as child class.

At TekSlate, we offer resources that help you in learning various IT courses. We avail bothwritten material and demo video tutorials. 
To gain in-depth knowledge and be on par with  practical experience,
then explore Selenium Training in Bangalore.

** write a program to back a holiday in spicejet .com by inheriting the parent class spicejet.popup.

Public class bookaholisday.inheritence extends spicejet-popup {

@test

Public void verifyholiday() throws exception {

Driver .find elements(by.linktext(“holiday”).click();

New select[driver .findelements(by.id(“destination id”))).selectvisibletest(“id”);

}

Thread.sleep(4000);

Driver.find element(by.xpath(“//input[@id=’locator id’]”)).click();

Driver .find element(                      “”                         [2]   “)).click();

“                               “;                           “                     [3])).click();

}

} polymorphism:-

2The ability to define more methods with the same name is known as polymorphism.

2It is two types

1) overloading

2) overriding

1) over loading:-

2It occurs when more methods with the same name but with different parameters is known as overloading

Public void click(string str) {

Driver .findelements(by.linktext(str)).click();

}

Public void click (string str, string str1) {

Driver.find elements(by.linktest(str)).click();

Driver.findelements(by.linktest(str1).click();

}

Public static void main(string [] args) {

Google languages

g.open URL c;

g.click(“Hindi”,”English”);

g.click(“Gmail”);

2Login into gmail.com by inheriting the class Google languages parameter and override the method click

Learn more about Selenium Interview Questions in this blog post.

2) overriding:-

It occurs when we inherit parent class

àIf we are using the method is behaving in two ways in child class one way was as in parent class in another way

  • The updations which we made to the child class method is limited to child class only.
  • The memory authorization in proper [same the memory] with overloading and over rising

Encapsulation:-

  • The process of holding that operates into a single entity.

Abstraction:-

  • The process of word hiding the data and show the coessential features of the object is known as abstraction.
  • We can achieve abstraction by using access modifier by
  • Public, protected can be used in child class only.
  • The public can be used in a child class as well as they're in the entire project by creating the object.
  • Private objects can be used in the current class only
Inclined to build a Profession as Selenium Developer?
Enroll here for Free Demo on Selenium Training In Dallas.

Assignment:

    A Object Open URL Login Log out     B Compile Upload Send mail     C Register Print text box Print drop down

RUN:

Open URL 2 Login 2 compare 2 send 2 log out2 clone 2 Register 2print next box

 

You liked the article?

Like : 1

Vote for difficulty

Current difficulty (Avg): Medium

Recommended Courses

1/15

About Author
Authorlogo
Name
TekSlate
Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.


Stay Updated


Get stories of change makers and innovators from the startup ecosystem in your inbox