Showing posts with label WebDriver Examples. Show all posts
Showing posts with label WebDriver Examples. Show all posts

It Is most Important to learn shortcuts of eclipse IDE If you wants to speed up Selenium WebDriver test creation and execution process because performing each and every actions In eclipse using just mouse Is time consuming. If you knows keyboard shortcut keys to perform regular actions In eclipse then It will be very easy for you to do It within one second.

Earlier have shared many tutorial examples on selenium IDE different commands and Its usage. You can view each of that example on Selenium IDE Tutorial. Still many peoples are using selenium IDE to automate their small web applications and sometimes they needs to perform compatibility testing In Google Chrome and IE browsers like submitting form, registration, login etc. activities.

We can perform these activities very easily In google chrome and IE browsers using Selenium WebDriver and you can view related tutorials link on Selenium Tutorial. Is It possible to run selenium IDE test In Google Chrome? Yes.. Follow steps given bellow to run selenium IDE test In google chrome browser.

Part 10

46 : What is Polymorphism?
Answer : Polymorphism is ability using which we can create reference variables or methods which behaves differently in different programmatic context. Best example of polymorphism is human. We behaves differently with different people in different environment. Our behavior will be different when we meet to boss and meet to friend. Read more on Polymorphism in java.

47 : What is the advantages of Polymorphism?
Answer : Main advantage of polymorphism is code reusabilty. You can dynamically supply different implementations through polymorphism. So it will reduce your work volume in terms of handling and distinguishing various objects.

Part 9

41 : In java, What is return type of main method?
Answer : Main method doesn't have any return type. It is void.

42 : Can We Overload main method in java?
Answer : Yes, Java class can have any number of main methods so it is possible to overload main method. But when you run program, It will not execute overloaded main method. Always It will execute only public static void main(String[] args) method.

Part 8

36 : What is the difference between the Constructor and Method?
Answer : Main difference between the Constructor and Method is as bellow.

Constructor :
  1. Name of the constructor must be same as class name.
  2. Constructor must not have any return type.
  3. It is used to initialize the state of an object.
  4. It is not possible to call constructor directly. Constructors called implicitly when the new keyword creates an object.
Method :
  1. Method name can be any.
  2. Method must have return type.
  3. It is used to expose behavior of an object.
  4. Methods can be called directly.
Read more on Constructor and Method.

Part 7

31 : What is default value of local variable.
Answer : There is not any default value of local variable. You must have to initialize it. View more details on local variables in java.

32 : Java support constructor inheritance?
Answer : No, Constructor inheritance is not supported in java. View more details on constructor in java.

Part 6

26 : What is local variable in java?
Answer : Local variable is declared inside method or constructor and it is limited for that method or constructor only. View more detail on local variable in java.

Local Variable Example :
public class JavaVariable {

 public void Calc() {
  // Local Variables.
  int sum;
  int item1 = 5;
  int item2 = 7;
  sum = item1 + item2;
  System.out.println("Sum is : " + sum);

 public static void main(String args[]) {
  JavaVariable j = new JavaVariable();

Earlier we have talked about method overriding concept in java during THIS POST to change the implementation of parent class's method in sub class. In inheritance, Super keyword is used to refer object of immediate parent class. Generally we are using super keyword in inheritance for three different purpose. Let's see how and when to use super keyword in java. Interviewer can ask you this question so please understand how it works.

Part 5

21 : Explain System.out.println();

Answer :
  • System : is a final class in  java.lang package.
  • out : is a static member of system class. It is an instance of This stream is already open and ready to accept output data.
  • println : is a method of .It is an overloaded method.

Part 4

16 : Can we overload static methods? 

Answer : Yes.. There is not any restriction to overload static methods. We can overload static and non static methods in java. VIEW MORE on overloading in java.

Part 3

11 : Why main method is static?

Answer : As we know, We can access static stuff without creating object of class. Because of static keyword with main method, Java virtual machine can directly call it without creating object of class. This way it will provide kind of root to start execution of program.

12 : What is method overloading?

Answer : Method overloading is ability to create multiple methods with same in same class but with different signatures (different input parameters and types). Method names will be same but parameters will be different for all overloaded methods.

Part 2

6 : What is the difference between static and not static variable?

Answer : Main differences are as bellow.
  • Static variables are preceded by static keyword. For non-static variable, there is not any preceding keyword.
  • Memory is allocated for static variables at the time of class loading. Memory is allocated to non- static variables whenever an object is created.
  • Memory is allocated only once to static variables on class loading. Memory is allocated multiple time whenever a new object is created to non-static variables.
  • Static variable example : Collage name of students, Company name of employees..
READ MORE about static and non-static stuff.

7 : What is the difference between static and not static(Instance) method?

Answer : Difference between static and non static method is as bellow.
  • Method declared with static keyword is static method. If Method declared without static keyword then it is instance method.
  • No need of object to call static methods. Object needed to call instance method.
  • Can not access non static stuff inside static methods directly. Opposite to it, We can access static and non static stuff directly inside instance method.
READ MORE detail on static and non-static stuff.


1 : What is object in java?

Answer : Object Is an Instance of class and it has its own state and behavior. In real world we can say, Dog is object of Animal class which have different state like breed, color, name, hungry, etc and behavior  like wagging tail, fetching, barking etc.

2 : What is class?

Answer : A class is the blueprint or we can say template from which individual objects are created.

By default, Chrome driver browser instance opens with fresh profile when webdriver launch it. So your installed extensions in google chrome browser will not display in google chrome driver browser instance when you run test in chrome driver. Now supposing there is an extension(any xyz extension) which i wants to load with google chrome driver when run your test using selenium webdriver. Is is possible? How to load google chrome driver browser instance with extension? Yes we can do it.. You need to follow bellow given steps to load chrome driver with extension.

Earlier we already learnt how to execute selenium WebDriver test In different browsers like Mozilla Firefox (VIEW THIS POST), Google Chrome (VIEW THIS POST) and IE (VIEW THIS POST) browsers. Sometimes you also need to know browser and OS name and version where your selenium WebDriver tests are running. Supposing you are running your tests on cloud then you

Tool tips are very common elements of web page and visible on mouse hover of element. It can be on text box, link or anywhere else on the page. Sometimes we need to capture tool tip text In Selenium WebDriver to verify If text Is correct or not. Let's learn how to read tool tip text In selenium WebDriver test and then verify It.

If you site Is large then full page can take more time to get loaded completely. In such sites, Single action (like click on link on home page) can take more time as page takes more time to get fully loaded because WebDriver will wait for page get loaded successfully. Can we avoid or neglect this page loading to perform click action even page loading Is In process? Yes we can do It In Firefox driver.

Earlier we learnt many examples on how to create Firefox custom profile for selenium web driver test on run time to Download Different FilesHandle SSL CertificateDisable JavaScript,etc. We will use same concept here to avoid page loading to click on button.

Today most of the applications are using Java Scripts for client side processing like client side validations, etc. So It Is very Important to that If any error related to Javascript Is not present any page of application which can disturb application functionality or user experience In any browser.

What is JSON?
"JavaScript Object Notation" is full form of JSON and it is best way to store information in an organized, easy-to-access and easy to read and understand manner. Here we can use it to store selenium grid config parameters.

Earlier we learnt, How to start single node on one machine as described in THIS POST. Now our next question is "can we run multiple selenium grid nodes on same machine?". Answer is yes. Selenium grid allows us to run multiple nodes on same machine. In general, It is not required to run multiple nodes on same machine as we can control number of browsers as described in THIS POST and number of browser sessions in THIS POST. So it is easy to configure one node on one machine and run test on it as per requirements. But still let's see an example of running multiple nodes on same machine.