• USA : +1 973 910 5725
  • INDIA: +91 905 291 3388
  • info@tekslate.com
  • Login

Introduction to OOP’S Concept in Selenium

OOPS concepts:-[object oriented program]

It is having below concepts

1) class & objects

2) encapsulation

3) inheritance

4) polymorphism

5) abstraction

These are request 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 both written 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 (srting 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 over ride 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 were 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 over loading 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 accesseential features of the object is known as abstraction.
  • We can achieve abstraction by using access modifier by
  • Public, protected can be use in child class only.
  • Public can be use in child class as well as their in the entire project by creating the object.
  • Private objects can be use in the current class only

  

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

For an Indepth knowledge on Selenium, click on below

Summary
Review Date
Reviewed Item
Introduction to OOP'S Concept in Selenium
Author Rating
4

“At TekSlate, we are trying to create high quality tutorials and articles, if you think any information is incorrect or want to add anything to the article, please feel free to get in touch with us at info@tekslate.com, we will update the article in 24 hours.”

0 Responses on Introduction to OOP'S Concept in Selenium"

    Leave a Message

    Your email address will not be published. Required fields are marked *

    Site Disclaimer, Copyright © 2016 - All Rights Reserved.

    Support


    Please leave a message and we'll get back to you soon.

    I agree to be contacted via e-mail.