selenium webdriver interview questions



What is Web Driver.

Architecture of Selenium Web driver.

What is Absolute path and Relative path.

What is difference between driver.quit() and driver.close().

What are the element locators present.

Difference between Get() and Navigate() method.

Difference between implicit wait and Explicit waits.

How can we handle Dynamic id's.

How to capture Screenshots on failure test cases.

How to run same test scripts multiple times.

How can we perform parallel Testing.

What are the different testng annotation.

How to handle colors in selenium web driver.

How to handle Multiple Windows.

How to handle Multiple Frames.

Difference between Assert and Verify.

How to set Priorities for test scripts.

Difference between findelement and findelements.

What is dependency annotation.

How to find whether the element present in webpage or not.

How to find broken links in webpage.

How to work with dynamic Web Tables.

How to mouse hover on an element.

How to handle Ajax in selenium Web driver.

How to handle popup's.

Can we automate desktop application using selenium web driver.

Selenium Web Driver supports Record and Play.

What are the testing types supported by selenium web driver.

Difference between Selenium IDE,Selenium RC,Selenium Web Driver.

How can we get the text of the element.

How can we handle windows based popup's.

How to get css properties of an element.

What is TestNG and how it is better than Junit.

What are advantages of Automation Framework.

What are different types of frameworks.

1

Selenium Webdriver Uses


Selenium Webdriver is WebAutomation tool for testing the web application.It is open source tool.It supports different operating systems.It supports 6 different languages.We can test in all the web browsers.

Browsers:






















Above browsers supports by the selenium webdriver.


Platforms:

Operating System supports by selenium Webdriver is Windows,Mac,Linux.













Programming Languages Supports:

Java,.Net,Ruby,Php,Python,Perl.


















Selenium Grid:


Selenium Grid is a tool used to Run Parallel Test  across different machines and different browsers all at the same time. Parallel execution means running multiple tests at once.


Uses:

Selenium Web driver is opensource tool.
It supports multiple browsers.
It supports different platforms.
It supports Parallel Testing using Selenium Grid.
It Saves Testing Application Time.
It Reduces Cost.
It supports Multiple Languages.

0

Handling Multiple Frames using Selenium Webdriver


Frames is the html document which is embedded on another html document.So page on the page is frames.Generally Frames are used in web page when there are dynamic changes in webpage.Instead of loading whole webpage only frame are loaded.

Ex: Breaking news in news webpage.

How to Automate Frames:

Example 1:


When we are dealing with frames we have use switchTo() to  Frame()  method.

Syntax:  driver.switchTo().frame();

Handling Multiple Frames














Here in above image we have show you how to switch from frame1 to frame2 when two frame are different.

Step 1:
         First driver focus will be on normal webpage,So we have to switch from webpage to Frame1.
           
            driver.switchTo.frame("frame1");

Step 2:
        Now the driver focus is on frame1.if we want to switch from frame1 to frame2 then we have to switch to default content i,e webpage.
          
          driver.switchTo.defaultcontent();

Step3:
       Now the focus is on webpage again we have to switch from webpage to Frame2 now.
     
      driver.switchTo.frame("frame2");
            


        

Example 2:

















Here in above image we have show you how to switch from frame1 to frame2 when two frame are embedded.that means frame within frame. So in this case steps would be.


Step 1:
         First driver focus will be on normal webpage,So we have to switch from webpage to Frame1.
           
            driver.switchTo.frame("frame1");

Step 2:
        Now the driver focus is on frame1.if we want to switch from frame1 to frame2 then we can         directly switch to frame2. In this case no need to switch to default page (or) Normal webpage.
          
          driver.switchTo.frame("frame2");


Example:

public class Framesexp1

 {

WebDriver driver;
 

@Test
public void frame1() throws InterruptedException
{
           driver=new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.get("https://netbanking.hdfcbank.com/netbanking/");
driver.manage().window().maximize();
int number=frameNumber(By.xpath("//input[@class='input_password']"));
driver.switchTo().frame(number);
driver.findElement(By.xpath("//input[@class='input_password']")).sendKeys("123123");
int number1=frameNumber(By.xpath("//a[@href='javascript:void(0)']"));
driver.switchTo().frame(number1);
driver.findElement(By.partialLinkText("Know")).click();
}
        // This is generic method which can be used for frames.
public int frameNumber(By by)
{
int i;
int framecount=

               driver.findElements(By.tagName("frameset")).size();

for(i=0;i<framecount;i++)
{
driver.switchTo().frame(i);
int count=driver.findElements(by).size();

    if(count>0)
{
break;
}
}
driver.switchTo().defaultContent();
return i;
}
}





0

OOPS-Object Oriented Programming System




JAVA: 

        Java language is based on  Object oriented programming.Means in java we will be dealing with Class and Objects.


Principles of Java:

  1. Objects
  2. Class
  3. Encapsulation
  4. Abstraction
  5. Polymorphism
  6. Inheritance

0

Synchronization in Selenium Webdriver



Synchronization in selenium webdriver are handled by using "Waits".

Two types of waits available in selenium webdriver are



  1. Implicit wait
  2. Explicit wait
Implicit wait:


0