The Selenium IDE is an add- on to Firefox, At a basic level Selenium allows us to record user actions when browsing in Firefox, Replay recorded scripts, Convert recorded scripts into programming languages such as Java,Ruby  and more.
Selenium helps testers  to add verification and synchronization steps to the script during the recording process the IDE provides excellent support for writing automated test scripts in Selenium and gets better with every release. In this article we will focus on some Sample Selenium interview Questions and Answers and its use as an aid to writing automated test scripts in Java rather than as a test tool in its own right.

What is Automation Testing?

Automation testing or Test Automation is a process of automating the manual process to test the application/system under test. Automation testing involves use toa separate testing tool which lets you create test scripts which can be executed repeatedly and doesn’t require any manual intervention.

What are the benefits of Automation Testing?
Benefits of Automation testing are:
Supports execution of repeated test cases
Aids in testing a large test matrix
Enables parallel execution
Encourages unattended execution
Improves accuracy thereby reducing human generated errors
Saves time and money

Why should Selenium be selected as a test tool?

Selenium is free and open source and has a large user base and helping communities to have cross Browser compatibility (Firefox, chrome, Internet Explorer, Safari etc.)
Selenium has great platform compatibility (Windows, Mac OS, Linux etc.)supports multiple programming languages (Java, C#, Ruby, Python, Pearl etc.)and has fresh and regular repository developments and supports distributed testing.

 What is Selenium and what is composed of?

Selenium is a suite of tools for automated web testing. It is composed of 
Selenium IDE (Integrated Development Environment) :
 It is a tool for recording and playing back. It is a firefox plugin.
 WebDriver and RC : It provides the APIs for a variety of languages like Java, .NET, PHP, etc. With most of the browsers Webdriver and RC works.
Grid: With the help of Grid you can distribute tests on multiple machines so that test can be run parallel which helps in cutting down the time required for running in browser test suites.

What do we mean by Selenium 1 and Selenium 2?
Selenium RC and WebDriver, in a combination are popularly known as Selenium 2. Selenium RC alone is also referred as Selenium 1.

Which is the latest Selenium tool?

What are the testing types that can be supported by Selenium?

Selenium supports the following types of testing:
Functional Testing
Regression Testing

 Why should Selenium be selected as a test tool?

1. Selenium is free and open source.
2. Selenium have a large user base and helping communities.
3. Selenium have cross Browser compatibility (Firefox, chrome, Internet Explorer, Safari etc.)
4. Selenium have great platform compatibility (Windows, Mac OS, Linux etc.)
5. Selenium supports multiple programming languages (Java, C#, Ruby, Python, Pearl etc.)
6. Selenium has fresh and regular repository developments.
7. Selenium supports distributed testing.

What are the different types of waits available in WebDriver?
There are two types of waits available in WebDriver:
1. Implicit Wait
2. Explicit Wait

Implicit Wait: Implicit waits are used to provide a default waiting time (say 30 seconds) between each consecutive test step/command across the entire test script.Thus, subsequent test step would only execute when the 30 seconds have elapsed after executing the previous test step/command.

Explicit Wait: Explicit waits are used to halt the execution till the time a particular condition is met or the maximum time has elapsed. Unlike Implicit waits, explicit waits are applied for a particular instance only.

What are the limitations of Selenium?
Following are the limitations of Selenium:
Selenium supports testing of only web based applications
Mobile applications cannot be tested using Selenium
Captcha and Bar code readers cannot be tested using Selenium
Reports can only be generated using third party tools like TestNG or Junit.
As Selenium is a free tool, thus there is no ready vendor support though the user can find numerous helping communities.User is expected to possess prior programming language knowledge.

When should I use Selenium IDE?
Selenium IDE is the simplest and easiest of all the tools within the Selenium Package. Its record and playback feature makes it exceptionally easy to learn with minimal acquaintances to any programming language. Selenium IDE is an ideal tool for a naïve user.

How do I launch the browser using WebDriver?
The following syntax can be used to launch Browser:
WebDriver driver = new FirefoxDriver();
WebDriver driver = new ChromeDriver();
WebDriver driver = new InternetExplorerDriver();

What is Selenese?

Selenese is the language which is used to write test scripts in Selenium IDE.

When should I use Selenium Grid?
Selenium Grid can be used to execute same or different test scripts on multiple platforms and browsers concurrently so as to achieve distributed test execution,testing under different environments and saving execution time remarkably.

What is Selenium? What are the different Selenium components?
Selenium is one of the most popular automated testing suites. Selenium is designed in a way to support and encourage automation testing of functional aspects of web based applications and a wide range of browsers and platforms. Due to its existence in the open source community, it has become one of the most accepted tools among the testing professionals.
Selenium is not just a single tool or a utility, rather a package of several testing tools and for the same reason it is referred to as a Suite. Each of these tools is designed to cater different testing and test environment requirements.
The suite package constitutes of the following sets of tools:
Selenium Integrated Development Environment (IDE) – Selenium IDE is a record and playback tool. It is distributed as a Firefox Plugin.
 Selenium Remote Control (RC) – Selenium RC is a server that allows user to create test scripts in a desired programming language. It also allows executing test scripts within the large spectrum of browsers.
Selenium WebDriver – WebDriver is a different tool altogether that has variousadvantages over Selenium RC. WebDriver directly communicates with the web browser and uses its native compatibility to automate.
Selenium Grid – Selenium Grid is used to distribute your test execution on multipleplatforms and environments concurrently.

What is an Xpath?
Xpath is used to locate a web element based on its XML path. XML stands for Extensible Markup Language and is used to store, organize and transport arbitrary data. It stores data in a key-value pair which is very much similar to HTML tags.Both being markup languages and since they fall under the same umbrella, Xpath can be used to locate HTML elements.The fundamental behind locating elements using Xpath is the traversing between various elements across the entire page and thus enabling a user to find an element with the reference of another element.

How to type in a textbox using Selenium?

User can use sendKeys(“String to be entered”) to enter the string in the textbox.Syntax:
 WebElement username = drv.findElement(“Email”));
// entering username

How can you find if an element in displayed on the screen?
WebDriver facilitates the user with the following methods to check the visibility of the web elements. These web elements can be buttons, drop boxes, checkboxes,radio buttons, labels etc.
boolean buttonPresence = driver.findElement(“gbqfba”)).isDisplayed();
boolean buttonSelected =driver.findElement(“gbqfba”)).isDisplayed();
boolean searchIconEnabled = driver.findElement(“gbqfb”)).isEnabled();

Can you explain the phase of Automation Testing LifeCycle?
Outline the potential benefits and test tool proposal.
Test tool evaluation and selection.
Steps necessary to outline automated testing to the project.
Identifies the test procedure standards, defines the tests, defines development.
Test plans are executed.
This is done throughout the life-cycle.

What are the different types of locators in Selenium?
Locator can be termed as an address that identifies a web element uniquely within the webpage. Thus, to identify web elements accurately and precisely we have different types of locators in Selenium:
CSS Selector

What are the different types of Drivers available in WebDriver?
The different drivers available in WebDriver are:

What is difference between assert and verify commands?

 Assert command checks whether the given condition is true or false. Let’s say we assert whether the given element is present on the web page or not. If the condition is true then the program control will execute the next test step but if the condition is false, the execution would stop and no further test would be executed.
Verify command also checks whether the given condition is true or false. Irrespective of the condition being true or false, the program execution doesn’t halts i.e. any failure during verification would not stop the execution and all the test steps would be executed.

What are the steps to run automation using selenium?
The very basic steps are:
Record the test steps using selenium-IDE.
Modify the script according to the testing needs.
Add validation points, Java Scripts,
Time-out etc.
Run the test.
View the result after test run complete analyze.

What are the capabilities of Selenium IDE?

Selenium IDE (Integrated Development Environment) works similar to commercial tools like QTP, Silk Test and Test Partner etc.
The below points describes well about Selenium IDE.
Selenium IDE is a Firefox add-on.
Selenium IDE can support recording the clicks, typing, and other actions to make a test cases.
Using Selenium IDE, a tester can play back the test cases in the Firefox browser.Selenium IDE supports exporting the test cases and suites to Selenium RC.
Debugging of the test cases with step-by-step can be done.
Breakpoint insertion is possible.
Page abstraction functionality is supported by Selenium IDE.
Selenium IDE can supports an extensibility capability allowing the use of add-ons or user extensions that expand the functionality of Selenium IDE

How to find more than one web element in the list?
At times, we may come across elements of same type like multiple hyperlinks,images etc arranged in an ordered or un ordered list. Thus, it makes absolute sense to deal with such elements by a single piece of code and this can be done using WebElement List.
Sample Code

// Storing the list
List elementList = driver.findElements(By.xpath(“//div[@id=’example’]//ul//li”));
// Fetching the size of the list
int listSize = elementList.size();
for (int i=0; i {
// Clicking on each service provider link
// Navigating back to the previous page that stores link to service providers

What is the difference between driver.close() and driver.quitcommand?

close(): WebDriver’s close() method closes the web browser window that the user is currently working on or we can also say the window that is being currently accessed by the WebDriver. The command neither requires any parameter nor does is return any value.
quit(): Unlike close() method, quit() method closes down all the windows that the program has opened. Same as close() method, the command neither requires any parameter nor does is return any value.

How can we get a text of a web element?

Get command is used to retrieve the inner text of the specified web element. The command doesn’t require any parameter but returns a string value. It is also one of the extensively used commands for verification of messages, labels, errors etc displayed on the web pages.

String Text = driver.findElement(“Text”)).getText();
What is the difference between “/” and “//” in Xpath?
Single Slash “/” –
Single slash is used to create Xpath with absolute path i.e. the xpath would be
created to start selection from the document node/start node.
Double Slash “//” –
Double slash is used to create Xpath with relative path i.e. the xpath would be
created to start selection from anywhere within the document.
How to select value in a dropdown?
Value in the drop down can be selected using WebDriver’s Select class.
Select selectByValue = new Select(driver.findElement(“SelectID_One”)));selectByValue.selectByValue(“greenvalue”);
Select selectByVisibleText = new Select

Select selectByIndex = new Select(driver.findElement(“SelectID_Three”)));

What are the different types of navigation commands?
Following are the navigation commands:
The above command requires no parameters and takes back the user to the previous webpage in the web browser’s history.
Sample code:
This command lets the user to navigate to the next web page with reference to the browser’s history.

Sample code:
navigate().refresh() –This command lets the user to refresh the current web page there by reloading all the web elements.
Sample code:
navigate().to() –This command lets the user to launch a new web browser window and navigate to the specified URL.
Sample code:

How to get title?

driver.getTitle();~To Print: System.out.println( driver.getTitle());
Can Selenium handle windows based pop up?

Selenium is an automation testing tool which supports only web application testing.Therefore, windows pop up cannot be handled using Selenium. QuestionsSample Selenium interview Questions and AnswersThe Selenium IDE is an add- on to Firefox, At a basic level Selenium allows us to record user actions when browsing in Firefox, Replay recorded scripts, Convert recorded scripts into programming languages such as Java,Ruby  and more. Selenium helps testers  to add verification and synchronization steps to the script during the recording process the IDE provides...Latest technology news