bing
Flat 10% & upto 50% off + Free additional Courses. Hurry up!
×
UPTO
50%
OFF!

Top Selenium Interview Questions And Answers

selenium interview questions
Here are top 20 objective type sample selenium Interview questions and their answers are given just below to them. These sample questions are framed by experts from Intellipaat who trains for selenium Training to give you an idea of type of questions which may be asked in interview. We have taken full care to give correct answers for all the questions. Do comment your thoughts Happy Job Hunting!

Interested in Learning Selenium? Click Here

Top Answers to Selenium Interview Questions

Basic Questions

Advanced Questions

1. Compare Automated Testing & Manual Testing
Criteria Automated testing Manual testing
Speed Excellent Average
Initial cost High Low
Operation Same operation each time Operations are not accurate
Recommended for Frequent testing scenario Single testing scenario
Concurrency Possible to test on different machines, OS and platforms simultaneously Needs different testers to test on multiple machines & platforms
2. When do we use Selenium Grid?

When want to run same or different test scripts on multiple platforms at a time, we use selenium grid. This helps us to test under various environments and also the loss of time consumed for testing is reduced.

CTA

Get Selenium Certification in just 36 Hours

CLICK HERE

close

3. What do you understand by software testing?

After an application is developed, it is checked by putting some test cases to find the errors and bugs in it. This process is called software testing.

4. Why Selenium?

Because it has following features –

  • It enables parallel execution of tests.
  • The outcomes are highly accurate and lesser number of errors occur.
  • Time and money saving tool.
  • Allows executing repeated test cases
5. List the different types of drivers available in Selenium WebDriver.
  • Firefox driver
  • Internet explorer driver
  • Chrome driver
  • Safari driver
  • Opera driver
  • Android Driver
  • iPhone Driver
  • HTMLUnit driver
6. How to use frame elements in Selenium on a page?
  • Manipulate frame and its content you must switch from its beginning. Similar task how we used to switch to a different page before interaction with it:

driver.switchTo ().frame (index);

  • Here index is zero-based index of the frame. Switching the frame directs to next interactions through the driver towards the selected frame. The frame method works under name, element ID and reference to already located elements.
  • To switch back to the default frame, use the defaultContent method.

driver.switchTo().defaultContent();

7. What are the different Selenium components?

The suite package constitutes of the following sets of tools :

  • Selenium Integrated Development Environment (IDE) – It is a Firefox plug-in which is easily installable along with other plug-ins. Since it has a simple framework, Selenium IDE should be used as prototyping tool. For advanced use cases, Selenium RC or WebDriver would be suitable.
  • Selenium Remote Control (RC) – It is a testing framework that allows the developers to write the code in any programming language. Usually it supports a wide spectrum of languages like Java, PHP, Python, Perl, C#, etc.
  • Selenium WebDriver – This tool has more advanced features than that of RC and IDE. It applies better approach to automate the browser activities. It does not typically rely upon JavaScript, it interacts with browser.
  • Selenium Grid – It works along with Selenium RC and runs tests on different nodes using different browsers simultaneously.

Check this tutorial, to know more about Selenium.

8. What test can selenium perform?

Selenium could be used for the functional, regression, load testing of the web based application. The automation tool could be implemented for the post release validation with a continuous integration tools like Jenkins, Hudson, QuickBuild or cruiseControl.

9. What programming languages are best for writing Selenium tests?

Selenium is a portable testing technology that comes with its own testing language called ‘Selenese’. However it also supports other programming language such as Java, Ruby, Python, C#, etc. When the tests are written in these programming languages, the codes communicate with the help of Selenium Client API.

Click here to know more about Selenium, in this Selenium Training course.

10. What are the test types supported by the Selenium?

There are basically three types of Selenium tests

  1. Functional – This is a kind of black-box testing in which the test cases are based on the software specifications.
  2. Regression – This testing strives to find new errors, regressions, etc., in different functional and non-functional areas of a code after alteration.
  3. Load testing – This test seeks to monitor the response of a device or system after putting a load on it. It is carried out to study the behavior of the system under certain conditions.
CTA

Download Selenium Interview questions asked by top MNCs in 2017 ?

11. How do I submit a form using Selenium?
WebElement el = driver.findElement(By.id("ElementID"));
el.submit();
12. What are Junit annotations?

Following are the Junit Annotations:

  • @TestAnnotation lets the system know that the method annotated as @Test is a test method. There can be multiple test methods in a single test script.
  • @Before: Method annotated as @Before lets the system know that this method shall be executed every time before each of the test methods.
  • @After: Method annotated as @After lets the system know that this method shall be executed every time after each of the test methods.
  • @BeforeClass: Method annotated as @BeforeClass lets the system know that this method shall be executed once before any of the test methods.
  • @AfterClass: Method annotated as @AfterClass lets the system know that this method shall be executed once after any of the test methods.
  • @Ignore: Method annotated as @Ignore lets the system know that this method shall not be executed.
13. Can Selenium test an application on Android browser?

Selenium should be able to handle Android browser. There is a Selenium Android Driver for running tests in the Android browser.
You can use Selendroid or Appium framework to test native apps or web apps in the Android browser.

Here is some code sample for it.

@BeforeClass
public static void startSelendroidServer() throws Exception {
if (selendroidServer != null) {
selendroidServer.stopSelendroid();
}
SelendroidConfiguration config = new SelendroidConfiguration();
config.addSupportedApp("selendroid-test-app-0.9.0.apk");
selendroidServer = new SelendroidLauncher(config);
selendroidServer.lauchSelendroid();
SelendroidCapabilities caps = new SelendroidCapabilities("io.selendroid.testapp:0.9.0");
driver = new SelendroidDriver(caps);
}

Read this blog, to know more about testing of web-application using Selenium.

14. When do we use findElement() and findElements()?
  • findElement(): It finds the first element in the current web page that matches to the specified locator value.

Syntax: WebElement element =driver.findElements(By.xpath(“//div[@id=’example’]//ul//li”));

  • findElements(): It finds all the elements in the current web page that matches to the specified locator value.

Syntax: List  elementList =driver.findElements(By.xpath(“//div[@id=’example’]//ul//li”));

Advanced Questions

1. What are the driver.close and driver.quit in WebDriver? Which is more preferable?

These are two different methods used to close the browser session in Selenium WebDriver.

  • driver.close – To close the browser window on which the focus is set.
  • driver.quit – To call the driver.dispose method that closes all the browser windows and ends the WebDriver session gracefully.

Know more about training course on Selenium to improve your web testing skills.

2. How is Selenium 2.0 configuration different than Selenium 1.0?

In case of Selenium 1.0 we need a Selenium jar file pertaining to one library, for example, in case of Java you need a Java client driver and also Selenium server jar file.

3. Can tests recorded using Selenium IDE be run in other browsers?

Yes. Although Selenium IDE is a Firefox add on, however,the  tests created in it can also be run in other browsers by using Selenium RC (Selenium Remote Control) and specifying the name of the test suite in command line.

For example:

with command line

c:\Program Files\Mozilla Firefox\firefox.exe” -chrome “chrome://selenium-ide/content/selenium/TestRunner.html?baseURL=http://localhost&test=file:///c:\tests\testsuite.html&auto=false”

With Java program

C:\Program Files (x86)\Java\jre6\bin\java.exe” -jar c:\seltest\selenium-server-standalone-2.18.0.jar -htmlSuite “*firefox” “http://127.0.0.1” “c:\seltest\mytestsuite.html” “c:\seltest\logs\results-firefox.html” -port 5555

4. How can we handle web based pop up?

Following are the four methods that can be used along with the Alert interface:

  • void dismiss() – The accept() method clicks on the “Cancel” button as and when the pop up window appears.
  • void accept() – The accept() method clicks on the “Ok” button the moment the pop up window appears.
  • String getText() – The getText() method returns the text displayed on the alert box.
  • void sendKeys(String stringToSend) – The sendKeys() method enters the specified string pattern into the alert box.

Syntax:
// accepting javascript alert
Alert alert = driver.switchTo().alert();
alert.accept();

Click here, to learn more about Selenium online certification training.

5. How to set the test case priority in TestNG?

Setting Priority in TestNG
Code Snippet

package TestNG;
import org.testng.annotations.*;
public class SettingPriority {
@Test(priority=0)
public void method1() {
}
@Test(priority=1)
public void method2() {
}
@Test(priority=2)
public void method3() {
}
}

Test Execution Sequence:
1. Method1
2. Method2
3. Method3

6. How to automate radio button in Selenium 2.0?

WebElement el = driver.findElement(By.id(“Radio button id”));

//to perform check operation

el.click()

//verfiy to radio button is check it return true if selected else false

el.isSelected()

7. How to handle the AJAX popup window?

By using getWindowHandles() and obj.switchTo.window(windowid), a programmer manages pop-ups using explicit wait and driver.swtchTo.window(“name”) commands for your requirements.

"4 Responses on Top Selenium Interview Questions And Answers"

  1. Rogerio Da Silva says:

    I like the questionaire. It summarises well what questions and key points that both employers and emplyees need to know.
    Thanks for sharing that.
    @roger_uk

  2. Srinivas B says:

    Thank you so much for valuable information.

  3. Karuna says:

    With this Interview Q and A. I come to know some technical tips on Selenium. It will be very helpful for my interview preparation.

  4. Shilpa says:

    This is a quality peace of work. Thank you for the good effort.

Leave a Message

100% Secure Payments. All major credit & debit cards accepted Or Pay by Paypal.
top

Sales Offer

  • To avail this offer, enroll before 27th May 2017.
  • This offer cannot be combined with any other offer.
  • This offer is valid on selected courses only.
  • Please use coupon codes mentioned below to avail the offer
offer-june

Sign Up or Login to view the Free Top Selenium Interview Questions And Answers.