Pages

Wednesday, 30 September 2015

New on Facebook

New on Facebook: Looping video profiles, temporary pictures, larger images

Coming soon to Facebook: Big changes to profiles

Some of the new features are:
  • Instead of a static photograph now users can upload a short, looping video clip that plays when people visit their profile on Facebook.
  • Users will also be able to temporarily change their profile picture while on vacation or for a major event and have it change back at a specified time.
  • Facebook is giving users new controls over what people can see when visiting their profile.
"We're making it easier for you to see what others can view by introducing a new customizable space at the top of your profile. You can curate this space— and convey what you want people to know about you— by changing the visibility of the fields that show up here," Facebook said. "You can also fill out the new, one-line 'Bio' field: select certain public About fields like work and education details to appear there; and even visually highlight what’s important to you by choosing up to five Featured Photos to be showcased at the top of your profile. While this space is visible to anyone who visits your profile, you have full control of what information appears here."

The giant social network is rolling out the features to a small number of users on iOS in California and the United Kingdom before introducing the changes more broadly. The reason Facebook is focusing on profiles: It says people visit them four billion times a day.

Among other changes: Facebook is also making profile pictures and videos bigger and more prominent.


"We believe these improvements to profile will give people more ways to connect and share with each other, and express themselves in meaningful ways," the company said.

Inheritance: Tutorials For Selenium WebDriver

Inheritance : Tutorials For Selenium WebDriver

What Is Inheritance In Java?

Inheritance is one of the feature of Object-Oriented Programming (OOPs). Inheritance allows a class to use the properties and methods of another class. In other words, the derived class inherits the states and behaviors from the base class. The derived class is also called subclass and the base class is also known as super-class. The derived class can add its own additional variables and methods. These additional variable and methods differentiates the derived class from the base class.

Inheritance(parent-child) Is very useful concept of java object oriented programming language by which we can reuse the code of parent class. Inheritance Is providing us a mechanism by which we can inherit the properties of parent class In to child class. Example : Audi class Is child class of Car class then Audi class can access/use all the non private properties (methods, variables..etc) of Car class. Using Inheritance, we can reuse the code of parent class In to child class so that size of code will decrease. Maintenance of code will be also very easy.

Inheritance is a compile-time mechanism. A super-class can have any number of subclasses. But a subclass can have only one superclass. This is because Java does not support multiple inheritance.

VIEW EXAMPLE OF USING INHERITANCE IN SELENIUM WEBDRIVER

extends keyword Is used to Inherit child class from parent class. Let me show you very simple example of Inheritance In java. In this example, Car class Is parent class of Audi class so all the non private properties of Car class are Inherited and able to use In Audi class.

Parent Class
public class Car {//Car Class Is Parent Class Of Audi Class
private String type="Vehicle";
public static int wheels = 4;
public String color = "blue";
String fuel = "Petrol";
public String getfuel(){
return fuel;
}
protected void Seats(){
int seat = 4;
System.out.println("Car Seats = "+seat);
}
}

Child Class or Sub Class

public class Audi extends Car{//Audi Is child Class Of Car Class.
public int speed=150;
public static void main(String[] args) {
Audi A = new Audi();
A.printdetails();
//Can access instance variable of parent class using object reference of child class Inside static methods.
System.out.println("Color Of Audi = "+A.color);
//Can access non static method of parent class using object reference of child class Inside static methods.
System.out.println("Fuel Of Audi = "+A.getfuel());
}
public void printdetails(){
//Can access class variables of parent class directly Inside child class non static methods.
System.out.println("Wheels Of Audi = "+wheels);
System.out.println("Speed Of Audi = "+speed);
//Can access non static methods of parent class directly Inside child class non static methods.
Seats();
//Can not access private variable of parent class In child class.
//System.out.println("Wheels Of Audi = "+type);
}
}

Output of above example will looks like bellow.
Wheels Of Audi = 4
Speed Of Audi = 150
Car Seats = 4
Color Of Audi = blue
Fuel Of Audi = Petrol

Overriding

In sub class, When you create a method with same signature, return types and arguments of parent class's method then that sub class's method Is known as overridden method and It Is called as overriding In java. Overriding Is useful to change to the behavior of parent class methods. Let me show you simple example of method overriding In java.

Note : Method overriding is different than method overloading. VIEW POST on method overloading.

Consider same above given example. Generally all cars have 4 seats so we have created Seats() method with 4 seat variable. But supposing ford car has 6 seats and I wants to print 6 seats for Ford car. In this case we can use method overriding In Ford class as bellow. For this example, Consider Car class of above example as parent class of Ford class. Here method Seats() Is overridden In sub class.
public class Ford extends Car{//Ford Is child Class Of Car Class.

public static void main(String[] args) {
Car C = new Ford();//Created Ford Class object with Car Class reference.
C.Seats();
}
//Parent class method Seats Is overridden In child class.
protected void Seats(){
int seat = 6;
System.out.println("Audi Seats = "+seat);
}

}

Output of above example will looks like bellow.
Audi Seats = 6


Tuesday, 29 September 2015

Setup and Configuration for Selenium Webdriver With Eclipse and Java

Setup and Configuration for Selenium Webdriver With Eclipse and Java

Introduction
In this tip, we will learn how to setup and configure Selenium Webdriver using Eclipse IDE and Java & run your first test script.

Step 1

In the first step, download and install JDK (Java Development Kit) in your system.

For downloading Java, you need to visit the following link:

  • http://www.oracle.com/technetwork/java/javase/downloads/index.html
Install_JDK
















Step 2

In the second step, download and install Eclipse from the link below:

  • http://www.eclipse.org/downloads/
Eclipse_IDE



Step 3

Download the Selenium Java Client Driver from:

  • http://docs.seleniumhq.org/download/
Java_Client_Driver


Click on the download link for Java language, you will get a ZIP file named “selenium-2.43.0.zip”. Then extract the contents of this ZIP file on any location say “D:\selenium-2.43.0\”. The unzipped folder contains the ‘libs’ folder, 2 jar files and Change Log.

Step 4

Configure Eclipse to work with Webdriver:

  • Double click on ‘Eclipse.exe’ to launch eclipse
  • When asked to select for a workspace, just accept the default location. Or, you can change the location.
Launch_Eclipse



  • Create a new project through File ? New ? Java Project. Name the project as “MyProject”.
  • Right-click on the newly created project and select New > Package, and name that package as “MyPackage”.
  • Create a new Java class under MyPackage by right-clicking on it and then selecting New > Class, and then name it as “MyClass”. Your Eclipse IDE should look like the image below:
New_Project



Step 5

Add Jar Files to the Library:

  • Right-click on MyProject and select “Build Path” and then “Configure Build Path”.
Build_Path


  • This will open the Libraries tab in Properties dialog. Then on click “Add External JARs...”


Add_Jar_Files

  • Navigate to D:\selenium-2.43.0\ (or any other location where you saved the extracted contents of “selenium-2.43.0.zip”).
  • Add all the JAR files inside and outside the “libs” folder.
These are the Jar files present outside the Libs folder:

Lib_Outside

These are the Jar files present inside the Libs folder:


  • Then your Properties dialog should look similar to the image below:
Properties_Jar_Files



  • Finally, click on the OK button and we are done with importing Selenium libraries into our project. Now, we are ready to write our test script in Eclipse and run it in WebDriver.