1)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 provide 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


2) What tests can selenium do?
Selenium could do functional, regression, and load of web based applications.


3) What are the main components of Selenium testing tools?
Selenium IDE, Selenium RC and Selenium Grid


4) What are the types of text patterns available in Selenium?
There are three types of patterns available in Selenium:
globbing
regular expressions
exact


5) For which operating system (OS) selenium support?
MS Window, Linux, Macintosh


6) What is Automation testing?
Automation testingor Test Automation is a process to simulate user actions of application under test.
Automation testing with help of available testing tools such as Selenium WebDriver helps in creating automated test scripts and reduces the execution time, increases the efficiency and removes manual intervation.


7). What are some advantages of selenium?
. Following are the advantages of selenium-
Selenium is open source and free to use without any licensing cost.
It supports multiple languages like Java, ruby, python etc.
It supports multi browser testing.
It has good amount of resources and helping community over the internet.
Using selenium IDE component, non-programmers can also write automation scripts
Using selenium grid component, distributed testing can be carried out on remote machines possible


8) How will you find an element using Selenium?
In Selenium every object or control in a web page is referred as an elements, there are different ways to find an element in a web page they are
ID
Name
Tag
Attribute
CSS
Link text
PartialLink Text
Xpath etc


9) List out the test types that are supported by Selenium?
For web based application testing selenium can be used
The test types can be supported are
a) Functional
b) Regression
For post release validation with continuous integration automation tool could be used
a) Jenkins
b) Hudson
c) Quick Build
d) CruiseCont

10) Explain how you can capture server side log Selenium Server?
To capture server side log in Selenium Server, you can use command

11) 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


12) Difference between Absolute path & Relative path.
Absolute path will start with root path (/) and Relative path will from current path (//)


13) What is the price of Selenium license per server?
Selenium is open source software, released under the Apache 2.0 license and can be downloaded and used without charge.


14) Comparative discussion Between UFT/QTP vs Selenium?
Only web applications can be tested using Selenium testing suite. However, UFT/QTP can be used for testing client server applications as well as Web Applications. Selenium supports following web browsers: Internet Explorer, Firefox, Safari, Opera or Konqueror on Windows, Mac OS X and Linux. However, UFT/QTP supports Internet Explorer/Chrome/Firefox on Windows.
QTP uses scripting language implemented on top of VB Script. However, Selenium test suite has the flexibility to use many languages like Java, .Net, Perl, PHP, Python, and Ruby.


15) Name some open source tools otherthan Selenium ?
WATIR- Web Application Testing In Ruby, is a functional testing tool for web applications which uses Ruby scripting language..
Sahi- It is also an automation tool used to automate web applications which is developed in java and javascript..
WET- Web Tester is also a web automation testing tool which uses Watir as the library to drive web pages..


16) What are the Components of Selenium ?
Selenium IDE
Selenium Remote Control
Selenium Grid


17)List out the technical challenges with Selenium?

Technical challenges with Selenium are
Selenium supports only web based applications
It does not support the Bitmap comparison
For any reporting related capabilities have to depend on third party tools
No vendor support for tool compared to commercial tools like HP UFT
As there is no object repository concept in Selenium, maintainability of objects becomes difficult.


18) Using Selenium how can you handle network latency ?
To handle network latency you can use driver.manage.pageloadingtime for network latency


19) What are the testing types that can be supported by Selenium?
Selenium supports the following types of testing:
Functional Testing
Regression Testing


20) What are the features of Selenium?
TestNG is a testing framework designed to simplify a broad range of testing needs, from unit testing (testing a class in isolation of the others) to integration testing (testing entire systems made of several classes, several packages and even several external frameworks, such as application servers). You can use test suite,annotations, automatically generation of report and much more.


21) How to write the tests in selenium WebDriver?

In selenium WebDriver, depending on the programming language, I used different test framework. In C#, I used NUnit, and in Java, I used JUnit. In either programming language, I defined browser webdriver in setup method, and wrote test steps in test method and dispose and close the webdriver in the tear down method.


22) Where to download Selenium?
Selenium can be downloaded and installed for free from seleniumhq.org


23) Which language selenium support?
To enhance the automated test cases Java, C#, PHP, Python, Perl, Ruby etc.are used. Java is most used used in automated testing.


24) What is Selenium WebDriver?
WebDriver is an opensource web automation tool which provides support for multiple browser, platforms and language.
Brief History: Selenium developed by Jason Huggins in 2004. Later in 2006 and engineer from google named Simon Stewartstarted working
on webDriver and though to remove the limitation and merged selenium with WebDriver in 2008, also known as Selenium 2.0 in 2009 Simon Stewart declared the reason why both of the project were merged.


25) What is Selenium IDE ?
Selenium IDE (Integrated Development Environment) is an ideal tool used to develop selenium test scripts... It is the only flavor of selenium which allows us to record user actions on browser window... Here, the scripts are recorded in 'Selenese'(a set of selenium commands like Click, assertTextPresent, storeText, etc,.).. It is not only a time-saver but also an excellent way of learning Selenium scripts syntax... It is a Firefox add-0n...


26) What is Test Runner ?
Test Runner allows you to run the test case in a browser loaded with the Selenium-Core Test Runner. Test runner is invoked by clicking the below Shown button in the IDE.


27) What is the price of Selenium license per server?
Selenium is open source software, released under the Apache 2.0 license and can be downloaded and used without charge.


28) Why testers should opt for Selenium and not QTP?
Selenium is more popular than QTP as
Selenium is an open source whereas QTP is a commercial tool
Selenium is used specially for testing web based applications while QTP can be used for testing client server application also
Selenium supports Firefox, IE, Opera, Safari on operating systems like Windows, Mac, linux etc. however QTP is limited to Internet Explorer on Windows.
Selenium supports many programming languages like Ruby, Perl, Python whereas QTP supports only VB script


29) How Selenium grid hub keeps in touch with RC slave machine?
At predefined time selenium grid hub keeps polling all RC slaves to make sure it is available for testing. The deciding parameter is called “remoteControl PollingIntervalSeconds” and is defined in “grid_configuration.yml”file


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


31) ) What are the disadvantages of Selenium?
Disadvantages of Selenium:
• Limitation in terms of browser support (It runs only in Mozilla).Scripts written using Selenium IDE can be used for other browsers only if it is used with Selenium RC or Selenium Core.
• We can’t run recorded script if it is converted to Java, C#, Ruby etc.
• Not allowed to write manual scripts like conditions and Loops for Data Driven Testing
• There is no option to verify images.


32) How to select the value from dropbox?
We can use: Select class & then selectByIndex(int index), selectByValue(string value), selectByVisibleText(String text).
Example : In this example we will navigate to webpage & from dropbox we will select the third value :-
public class NewTest
{
WebDriver driver;
@Test
public void f()
{
driver = new FirefoxDriver();
driver.navigate().to(“http://www.iamchandan.com/html-webpage-selenium-practice/”);
WebElement element = driver.findElement(By.xpath(“/html/body/div/div[3]/div/div/div[1]/main/article/div/form/p[5]/select”));
Select se = new Select(element);
se.selectByIndex(2);
}
}
33) What are some limitations of selenium?
Following are the limitations of selenium-
We cannot test desktop application using selenium.
We cannot test web services using selenium.
For creating robust scripts in selenium webdriver, programming langauge knowledge is required.
We have to rely on external libraries and tools forperforming tasks like - logging(log4J), testing framework-(testNG, JUnit), reading from external files(POI for excels) etc.
34) How to do file upload in selenium?
. File upload action can be performed in multiple ways-
Using element.sendKeys("path of file") on the webElement of input tag and type file i.e. the elements should be like -
2.<input type="file" name="fileUpload">
Using Robot API.
Using AutoIT API.
35) What is the difference between an assert and a verify with Selenium commands?
Effectively an “assert” will fail the test and abort the current test case, whereas a “verify” will fail the test and continue to run the test case.


36) What are the four parameter you have to pass in Selenium?
Four parameters that you have to pass in Selenium are
Host
Port Number
Browser
URL
37) Can WebDriver test Mobile applications?
WebDriver cannot test Mobile applications. WebDriver is a web based testing tool, therefore applications on the mobile browsers can be tested.


38) Difference between Selenium RC and Selenium
webdriver?

Selenium RC

Selenium Web driver

Selenium RC’s architecture is way more complicated.

Web Driver’s architecture is simpler than Selenium RC’s.

Selenium RC is slower since it uses a JavaScript program called Selenium Core. This Selenium Core is the one that directly controls the browser, not you.

Web Driver is faster than Selenium RC since it speaks directly to the browser uses the browser’s own engine to control it.

Selenium Core, just like other JavaScript codes, can access disabled elements.

Web Driver interacts with page elements in a more realistic way.

Selenium RC’s API is more matured but contains redundancies and often confusing commands.

Web Driver’s API is simpler than Selenium RC’s. It does not contain redundant and confusing commands.

Selenium RC cannot support the headless HtmlUnit browser. It needs a real, visible browser to operate on.

Web Driver can support the headless HtmlUnit browser.

Selenium RC Has Built-In Test Result Generator. Selenium RC automatically generates an HTML file of test results.

Web Driver has no built-in command that automatically generates a Test Results File.

Selenium RC needs the help of the RC Server in order to do so.

web Driver directly talks to the browser

Selenium RC can support new browsers

It cannot readily support new browsers


  • 38). What is an XPath?
Xpath or XML path is a language for selecting nodes from XML documents. XPath is one of the locators supported by selenium webdriver.
39) How to do drag and drop in selenium?
Using Action class, drag and drop can be performed in selenium. Sample code-

1

2

3

4

5

6

Actions builder = new Actions(driver);

Action dragAndDrop = builder.clickAndHold(SourceElement)

.moveToElement(TargetElement)

.release(TargetElement)

.build();

dragAndDrop.perform();


  • 40 ) Explain how Selenium Grid works?
Selenium Grid sent the tests to the hub. These tests are redirected to Selenium Webdriver, which launch the browser and run the test. With entire test suite, it allows for running tests in parallel.
41) What is Selenese?
Selense is s a set of commands that were performed by a selenium tool on the web application.42) What are the four parameter you have to pass in Selenium?
Four parameters that you have to pass in Selenium are
Host
Port Number
Browser
URL
43) Can Selenium test an application on Android browser?
Selenium should be able to handle Android browser. There is experimental Selenium Android Driver for running tests in Android browser.
44) Explain what is assertion in Selenium and what are the types of assertion?
Assertion is used as a verification point. It verifies that the state of the application conforms to what is expected. The types of assertion are “assert” , “verify” and “waifFor”.
45) What is Junit?
Junit is a unit testing framework introduced by Apache. Junit is based on Java.

46) FirefoxDriver is class or an interface and from where is it inherited ?FirefoxDriver is a class. It implements all the methods of WebDriver interface

47) What is a relative XPath?
A relative XPath is a way of locating an element using an XML expression beginning from anywhere in the HTML document. There are different ways of creating relative XPaths which are used for creating robust XPaths (unaffected by changes in other UI elements).
Example - //input[@id='username']
48) What is difference between Borland Silk test and Selenium?
Selenium is completely free test automation tool, while Silk Test is not. Only web applications can be testing using Selenium testing suite. However, Silk Test can be used for testing client server applications. Selenium supports following web browsers: Internet Explorer, Firefox, Safari, Opera or Konqueror on Windows, Mac OS X and Linux. However, Silk Test is limited to Internet Explorer and Firefox.
Silk Test uses 4Test scripting language. However, Selenium test suite has the flexibility to use many languages like Java, .Net, Perl, PHP, Python, and Ruby.
49) What is selenium RC (Remote Control)?
Selenium IDE have limitations in terms of browser support and language support. By using Selenium RC limitation can be diminished.
On different platforms and different web browser for automating web application selenium RC is used with languages like Java, C#, Perl, Python
Selenium RC is a java based and using any language it can interact with the web application
Using server you can bypass the restriction and run your automation script running against any web application50) Mention what is desired capability? How is it useful in terms of Selenium?
The desired capability is a series of key/value pairs that stores the browser properties like browser name, browser version, the path of the browser driver in the system, etc. to determine the behavior of the browser at run time.51) 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.52) 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(By.id(“Email”));
// entering username
username.sendKeys(“sth”);53) What tests can selenium do?
Selenium could do functional, regression, and load of web based applications54) What are the different access specifiers in Java?
private, default, protected and public.55 ) Which Selenium command(s) simulates selecting a link?
click, clickandWait, ClickAt, ClickAtandWait, DoubleClick, DoubleClickandWait, doubleClickAt, doubleClickAtandWait56) What tests can selenium do ?
Selenium is mainly used for Functional testing, Regression testing and Load/Stress testing for web based applications... 57) What is Selenium 2.0?
Web testing tools Selenium RC and WebDriver are consolidated in single tool in Selenium 2.058) What is the use of logging in automation?
Logging helps in debugging the tests when required and also provides a storage of test's runtime behaviour.59) What is assertion and what are the different types of assertions available in Selenium?
You can perform different assertions on the application such as text, alert, editable, checked etc.One of the popular assertion and my favorite is assertTrue(message, condition).
60) How to use globs in Selenium?
Suppose we want to find/ search for the text “America” or “American”, then we could use it as Ame*
In Selenium, that would mean the following:

Command

Target

Value

verifyTextPresent

Glob: Ame*



61) Which Selenium command(s) simulates selecting a link?
click, clickandWait, ClickAt, ClickAtandWait, DoubleClick, DoubleClickandWait, doubleClickAt, doubleClickAtandWait
62) Other than the default port 4444 how you can run Selenium Server?
You can run Selenium server on java-jar selenium-server.jar-port other than its default port63) 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.64) What are desired candidates?
Desired Capabilities help to set properties for the Web Driver. A typical use case would be to
set the path for the Firefox Driver if your local installation doesn't correspond to the default
settings.
65) What are the advantages of Automation framework?
Advantage of Test Automation framework Reusability of code Maximum coverage Recovery scenario Low cost maintenance Minimal manual intervention Easy Reporting66) How can I read test data from excels?
Test data can efficiently be read from excel using JXL or POI API. See detailed tutorial here.
67) Explain how Selenium Grid works?
Selenium Grid sent the tests to the hub. These tests are redirected to Selenium Webdriver, which launch the browser and run the test. With entire test suite, it allows for running tests in parallel.68) How can we clear a text written in a textbox?
Using clear() method we can delete the text written in a textbox.
driver.findElement(By.id("elementLocator")).clear();
69) . How to check a checkBox in selenium?
The same click() method used for clicking buttons or radio buttons can be used for checking checkbox as well.
70) How can we make one test method dependent on other using TestNG?
Using dependsOnMethods parameter inside @Test annotation in testNG we can make one test method run only after successful execution of dependent test method.
<span style="color: rgb(54, 96, 146);"><span style="color: rgb(36, 64, 97);"> <strong>@Test</strong>(dependsOnMethods = { "preTests" })
</span>
</span>
71). How can we set priority of test cases in TestNG?
Using priority parameter in @Test annotation in TestNG we can define priority of test cases. The default priority of test when not specified is integer value 0. Example-
<span style="color: rgb(54, 96, 146);"><span style="color: rgb(36, 64, 97);"><strong>@Test</strong>(priority=<strong>1</strong>)
</span>
</span>
72) How to install Selenium IDE ?
I use seleniumhq.org site to download any software regarding selenium.. Here, if we click on the version number of selenium ide it starts downloading the add-ons, just we have to click on 'install now' button and restart the firefox browser.. With-in 5 minutes we can install selenium ide...
73) How do you open/start selenium-ide after installation ?
First launch/open firefox browser and then click on 'Tools' tab in the menu bar.. You can see an option called 'selenium ide' , click on it, a small window will be opened where you can start recording scripts...
74) What are the different testing type we can perform with selenium webdriver?
Selenium WebDriver support following types of testing :
1).Functional Testing
2).Regression Testing75) :What are the prerequisites to run selenium webdriver??
JDK, Eclipse, WebDriver(selenium standalone jar file), browser, application to be tested.
76) What are selenese?
Selenese is the language which is used to write scripts in Selenium IDE.
77) What is the use of driver.get("URL") and driver.navigate().to("URL") command? Is there any difference between the two?
Both driver.get("URL") and driver.navigate().to("URL") commands are used to navigate to a URL passed as parameter.
There is no difference between the two commands.
78) How can we write text to a textbox element in selenium?
Using sendKeys() method we can write text in a textbox-
WebElement searchTextBox = driver.findElement(By.id("search"));
searchTextBox.sendKeys("searchTerm");
79) How can we clear a text written in a textbox?
Using clear() method we can delete the text written in a textbox.
driver.findElement(By.id("elementLocator")).clear();
80) Compare Selenium with QTP..

Selenium is an open source(free of cost) where as QTP(have to purchase) is commercial tool..

Selenium is used for testing only web-based applications where as QTP can be used for testing client-server applications also..
Selenium supports Firefox, Internet Explorer, Safari, opera on operating systems like Windows, Mac, linux etc., however QTP is limited to Internet Explorer on Windows..
Selenium tests has the flexibility to use many languages like Java, C#, Python, Ruby, Perl and PHP where as QTP mainly supports VB script..
81)What do you think of Performance Testing?
Performance testing is a technical analysis done to determine or validate the speed, scalability and/or stability characteristics of the product under test. Performance-related activities such as testing and tuning are concerned with achieving response times, throughput and resource-utilization levels that meet the performance objectives for the application under test.
82) Which tool you have used for 'Performance Testing' ?
We used JMeter to test functional behavior and measure performance. It can be used to simulate a heavy load on a server, network or object to test its strength or to analyze overall performance under different load types. It provides features such as a multi-threaded framework, complete portability across a variety of platforms, capability to load and performance test many different server types, highly extensible, efficient GUI design and support for offline analysis of test results.
83) What test can Selenium do?
Selenium could be used for the functional, regression, load testing of the web based applications. The automation tool could be implemented for post release validation with continuous integration tools like Jenkins, Hudson, QuickBuild or CruiseControl.
84) What is the price of Selenium license per server?
Selenium is open source software, released under the Apache 2.0 license and can be downloaded and used without charge.85) How much does Selenium license cost per client machine?
Selenium is open source software, released under the Apache 2.0 license and can be downloaded and used without charge.
86) What is the latest version of Selenium?
The latest versions are Selenium IDE 1.3.0, Selenium Server (formerly the Selenium RC Server) 2.8.0, Selenium Client Drivers Java 2.8.0, Selenium Client Drivers C# 2.8.0, Selenium Client Drivers Ruby 2.8.0, Selenium Client Drivers Python 2.8.1, Selenium Grid 1.0.8.
87) How you can use “submit” a form using Selenium ?
You can use “submit” method on element to submit form-
element.submit () ;
Alternatively you can use click method on the element which does form submission
88) Explain what are the JUnits annotation linked with Selenium?
The JUnits annotation linked with Selenium are
@Before public void method() – It will perform the method () before each test, this method can prepare the test
@Test public void method() – Annotations @Test identifies that this method is a test method environment
@After public void method()- To execute a method before this annotation is used, test method must start with test@Before
89 ) Explain how to assert text of webpage using selenium 2.0 ?
WebElement el = driver.findElement(By.id(“ElementID”))
//get test from element and stored in text variable
String text = el.getText();
//assert text from expected
Assert.assertEquals(“Element Text”, text);
90) What are the names the Common five different types of exception encountered in Selenium WebDriver?
1). NoSuchElementException
2). WebDriverException
3). TimeOutException
4). NoSuchWindowException
5). StaleElementException
91) What are the different types of Driver implementation?
1). FirefoxDriver
2). ChromeDriver
3). InternetExplorerDriver
4). HTMLUnitDriver
5). RemoteWeDriver
6). Safari WebDriver
7). WebDriverBackedSelenium
92) Which WebDriver implementation is fastest and why?
HTMLUnitDriver is fastest and most lightweight implementation of webdriver.
HTMLUnit does not execute test on Browser but sends plain HTTP requests which makes test execution faster.
Pros :
Fastest implementation of WebDriver.
A pure java implementation so it is plateform independent.
Support java script.
Cons :Emulates other Browser’s JS behaviour.
93) :What is the difference between “Get” and “Navigate” to open a web Page in selenium WebDriver?
Getmethod will get page to load, get a page source or get the text of an element whereas navigate will guide through history likerefresh, back &forward.
Q94) How do you simulate browser back and forward?
Using back() & forward(), Methods.
driver.navigate().back();
driver.navigate().forward();
95) What is selenium?
Selenium is a robust test automation suite that is used for automating web based applications. It supports multiple browsers, programming languages and platforms.96) . What are different forms of selenium?
Selenium comes in four forms-
Selenium WebDriver - Selenium WebDriver is used to automate web applications using browser's native methods.
Selenium IDE - A firefox plugin that works on record and play back principle.
Selenium RC - Selenium Remote Control(RC) is officially deprecated by selenium and it used to work on javascript to automate the web applications.
Selenium Grid - Allows selenium tests to run in parallel across multiple machines.
97) What is the difference between type keys and type commands ?
TypeKeys() will trigger JavaScript event in most of the cases whereas .type() won’t. Type key populates the value attribute using JavaScript whereas .typekeys() emulates like actual user typing.
98) What is the difference between verify and assert commands?
Assert: Assert allows to check whether an element is on the page or not. The test will stop on the step failed, if the asserted element is not available. In other words, the test will terminated at the point where check fails.
Verify:Verify command will check whether the element is on the page, if it is not then the test will carry on executing. In verification, all the commands are going to run guaranteed even if any of test fails.
99) What is JUnit Annotations and what are different types of annotations which are useful ?
In JAVA a special form of syntactic meta-data can be added to Java source code, this is know as Annotations. Variables, parameters, packages, methods and classes are annotated some of the JUnit annotations which can be useful are
– Test
– Before
– After
– Ignore
– BeforeClass
– AfterClass
– RunWith
100) While using click command can you use screen coordinate?
To click on specific part of element, you would need to use clickAT command. ClickAt command accepts element locator and x, y co-ordinates as arguments-
clickAt (locator, cordString)
Selenium Interview Questions 1
Selenium Interview Questions 2
Selenium Interview Questions 3
Selenium Interview Questions 4