Selenium Tutorial 8

Selenium Tutorial 8

Recap:
 

1) Overview on Test Automation

2) Overview on Selenium

3) Selenium Test Process

4) Java for Selenium
--------
5) Java Environment setup

6) Java programme structure/Java Syntax

7) Writing comments

8) Java Data types

9) Java Modifiers

10) Java Variables

11) Java Operators

12) Java Conditional statements

13) Java Loop statements

14) String treatment inward Java

15) Arrays inward Java

16) Java Methods - Built-in methods

17) Java Methods - User defined methods

18) Java exception handling
---------------------------------------
Input in addition to Output Operations inward Java.
There are iii ways available for reading input:
i) Scanner

ii) DataInputStream

iii) BufferedReader
---------------
Using java.util.Scanner is the easier in addition to includes many methods to banking enterprise tally input information is valid to read.

Example:
package javaiooperations;
import java.util.Scanner;
public shape ReadInput {
public static void main(String [] args){
    Scanner scan = novel Scanner(System.in);
   
    System.out.println("Enter Your Name");
    String s1 = scan.nextLine();
    System.out.println("Your Name is: " + s1);
   
    System.out.println("Enter Your City Name");
    String s2 = scan.next();
    System.out.println("Your City Name is: " + s2);
   
    System.out.println("Enter Your Number");
    int a = scan.nextInt();
    System.out.println("Your Number is: " + a);
   
    System.out.println("Enter Your City Name");
    double b = scan.nextDouble();
    System.out.println("Value is: " + b);
    scan.close();
}
}
-------------------------------------------
File treatment inward Java
Two categories of File System Operations

i) High score operations / External operations

Create a folder

delete a folder

create a text file

delete a text file etc...

ii) Low score operations / Internal operations

Read data

Write information etc...
------------------------
Using File Class nosotros tin perform High score operations

Examples:
1) Create a Folder
package javaiooperations;

import java.io.File;

public shape CreateFolder {
   
    populace static void main(String [] args){
        File fileObject = novel File("C:/Users/G C Reddy/Desktop/Selenium");
        fileObject.mkdir();
        }
}
---------------------------------
2) Check the beingness of Selenium Folder


public static void main(String [] args){
        File fileObject = novel File("C:/Users/G C Reddy/Desktop/UFT");
        boolean a = fileObject.exists();
        System.out.println(a);
        }
-------------------------------------
3) Delete a Folder
public static void main(String [] args){
        File abc = novel File ("C:/Users/G C Reddy/Desktop/Selenium");
        abc.delete();
        boolean a = abc.exists();
        //System.out.println(a);
        if (a == true) {
            System.out.println("Folder exists");
        }
        else{
            System.out.println("Folder doesn't exist");   
        }
        }
-----------------------------------
4) Create a Text file
public shape CreateFolder {
   
    populace static void main(String [] args){
        File abc = novel File ("C:/Users/G C Reddy/Desktop/Selenium.txt");
        endeavor {
            abc.createNewFile();
        } choose handgrip of (IOException e) {
            // TODO Auto-generated choose handgrip of block
            e.printStackTrace();
        }
-------------------------------------------
5) Delete a text file


    populace static void main(String [] args){
        File abc = novel File ("C:/Users/G C Reddy/Desktop/Selenium.txt");
        abc.delete();
       
    }
------------------------------------               
Java OOPS
Inheritance

Polymorphism

Abstraction

Encapsulation
-------------------------------------------
Java Inheritance
> It is a procedure of inheriting (reusing) the shape members 9variables in addition to methods) from i shape to around other shape is called Inheritance.

> Non static (object level) shape members solely tin endure inherited.

> The shape from where the shape members are getting inherited is called every bit Super class/ Parent class/base class

> The shape to which the shape members are getting inherited is called
Sub class/ Child shape / Derived class.

> The Inheritance betwixt Super shape in addition to Sub shape is achieved using "extends" keyword.

Syntax:

Class SubClass extends SuperClass {
//body
}
They are iii types of Inheritance:

i) Single Inheritance
Ex:

Class B extends Class A
---------------------------
ii) Multi score inheritance:
Ex:

Class B extends Class A

Class C extends Class B

iii) Multiple Inheritance (*Java doesn't support)

Ex:

Class B extends Class A

Class C extends Class B

In Class C
add method
-----------------------------
Class C extends Class D
-------------------------------

Sumber http://www.gcreddy.com/
Post a Comment (0)
Previous Post Next Post