Selenium Interview Questions

Table of Contents

Selenium is one of the most dominant open source mechanization tools for web application testing which gives you a chance to computerize activities like — type, click, and the determination from a drop-down, and so on of a website page. A Quick Overview of Selenium
What is Selenium?
Selenium is an open source automated testing suite for web applications across different browsers and platforms.
Latest versionSelenium 4
Created byJason Huggins
Written injava
Selenium licenceApache License 2.0
Official websitehttps://www.seleniumhq.org

Development History

Jason Huggins had created Selenium in the year 2004 as an internal tool at Thought Works. In 2009, after a gathering between the developers at the Google Test Automation Conference, it was picked to consolidate the two tasks, and call the new venture Selenium Web Driver, or Selenium 2.0.

Latest Version

The most recent variant of Selenium is Selenium 4.

Advantages of Selenium

  1. Open Source Availability– As this is an open source tool, Selenium is a freely open computerization system and is free.
  2. Multi-Browser Support– Selenium script is compatible with all the browsers like Chrome, Firefox, Safari, Internet Explorer, Opera, and Edge browsers and they are the most utilized browsers worldwide.
  3. Support across Various Operating Systems– It supports and can work crosswise over various working frameworks like Windows, Linux, Mac OS, UNIX, and so on.
  4. Flexibility– highlights like regrouping and refactoring of experiments make Selenium progressively adaptable and usable when contrasted with other automation testing tools and thus it helps developers and analysers in quick changes to the code, decreasing duplication, limiting inconveniences and improving practicality.
  5. Less Hardware Usage– Selenium requires less equipment when contrasted with other testing devices.

Uses of Selenium

  • Selenium is used to treat or anticipate selenium inadequacy.
  • Selenium has been utilized in alternative medicine as a guide to treat Hashimoto’s thyroiditis and to treat elevated cholesterol. Not all uses for selenium have been endorsed by the FDA.
  • Using the selenium network component, distributed testing can be completed on remote machines possible.
There are some Selenium questions asked to the candidates in the interview:

CONCLUSION

Selenium testing tool has both pros and cons in comparison to other automation testing tools. On the conclusion note, the three significant highlights (cost, parallel testing and flexibility) of Selenium and its various segments made Selenium as outstanding amongst other computerization testing tools.

Q. 1) What is Selenium?
Selenium is an open-source (free) automated testing suite to test web applications. It supports different platforms and browsers. It has gained a lot of popularity in terms of web-based automated testing and giving a great competition to the famous commercial tool HP QTP (Quick Test Professional) AKA HP UFT (Unified Functional Testing).
Selenium is a set of different software tools. Each tool has a different approach to supporting web-based automation testing. It has four components namely,

  1. Selenium IDE (Selenium Integrated Development Environment)
  2.  Selenium RC (Selenium Remote Control)
  3.  Selenium WebDriver
  4.  Selenium Grid

Q. 1) What is Selenium IDE?
Selenium IDE (Integrated Development Environment) is a Firefox plugin. It is the simplest framework in the Selenium Suite. It allows us to record and playback the scripts. Even though we can create scripts using Selenium IDE, we need to use Selenium RC or Selenium WebDriver to write more advanced and robust test cases.

Q. 1) What is Automation Testing?
Automation testing is the process of testing the software using an automation tool to find the defects. In this process, executing the test scripts and generating the results are performed automatically by automation tools. Some most popular tools to do automation testing are HP QTP/UFT, Selenium WebDriver, etc.

Q. 2) What are the benefits of Automation Testing?

  • Saves time and money. Automation testing is faster in execution.
  • Reusability of code. Create one time and execute multiple times with less or no maintenance.
  • Easy reporting. It generates automatic reports after test execution.
  • Easy for compatibility testing. It enables parallel execution in the combination of different OS and browser environments.
  •  Low-cost maintenance. It is cheaper compared to manual testing in the long run.
  •  Automated testing is more reliable.
  •  Automated testing is more powerful and versatile.
  •  It is mostly used for regression testing. Supports the execution of repeated test cases.
  •  Minimal manual intervention. Test scripts can be run unattended.
  •  Maximum coverage. It helps to increase the test coverage.

Q. 3) What are the challenges and limitations of Selenium WebDriver?
As we all know Selenium WebDriver is a tool that automates the browser to mimic real user actions on the web. Selenium is a free open source testing tool. Some of the challenges with selenium web driver are as follows.

  1. We cannot test windows application.
  2.  We cannot test mobile apps
  3.  Limited reporting
  4.  Handling dynamic Elements
  5.  Handling page load
  6.  Handling pop up windows
  7.  Handling captcha

Q. 4) What type of tests have you automated ?
Our main focus is to automate test cases to do Regression testing, Smoke testing, and Sanity testing. Sometimes based on the project and the test time estimation, we do focus on End to End testing.

Q. 5)  How many test cases you have automated per day?
It depends on Test case scenario complexity and length. I did automate 2-5 test scenarios per day when the complexity is limited. Sometimes just 1 or fewer test scenarios in a day when the complexity is high.

Q. 6)  What is a Framework?
A framework defines a set of rules or best practices that we can follow in a systematic way to achieve the desired results. There are different types of automation frameworks and the most common ones are:

  • Data-Driven Testing Framework
  •  Keyword Driven Testing Framework
  •  Hybrid Testing Framework

Q. 7)  What is Selenium WebDriver?
Selenium WebDriver is a tool for writing automated tests of websites. It is an API name and aims to mimic the behavior of a real user, and as such interacts with the HTML of the application. Selenium WebDriver is the successor of Selenium Remote Control which has been officially deprecated.

Q. 8)  How is Selenium 2.0 configuration different than Selenium 1.0?
In the case of Selenium 1.0 you need Selenium jar file pertaining to one library for example in the case of java you need java client driver and also Selenium server jar file. While with Selenium 2.0 you need language binding (i.e. java, C#, etc) and Selenium server jar if you are using Remote Control or Remote WebDriver.

Q. 9)  Can you show me one code example of setting Selenium 2.0? Below is an example :
WebDriver driver = new FirefoxDriver();
driver.get("https://www.google.co.in/");
driver.findElement(By.cssSelector("#gb_2 > span.gbts")).click();
driver.findElement(By.cssSelector("#gb_1 > span.gbts")).click();
driver.findElement(By.cssSelector("#gb_8 > span.gbts")).click();
driver.findElement(By.cssSelector("#gb_1 > span.gbts")).click();

Q. 10)  Which web driver implementation is fastest?
HTMLUnitDriver. The simple reason is HTMLUnitDriver does not execute tests on browser but plain HTTP request-response which is far quicker than launching a browser and executing tests. But then you may like to execute tests on a real browser than something running behind the scenes

Q. 11)  What all different element locators are available with Selenium 2.0? Selenium 2.0 uses the same set of locators which are used by Selenium 1.0 – id, name, CSS, XPath but how Selenium 2.0 accesses them is different. In the case of Selenium 1.0, you don’t have to specify a different method for each locator while in case of Selenium 2.0 there is a different method available to use a different element locator. Selenium 2.0 uses following method to access elements with id, name, CSS and XPath locator –
driver.findElement(By.id("HTMLid"));
driver.findElement(By.name("HTMLname"));
driver.findElement(By.cssSelector("cssLocator"));
driver.findElement(By. className ("CalssName”));
driver.findElement(By. linkText ("LinkeText”));
driver.findElement(By. partialLinkText ("PartialLink”));
driver.findElement(By. tagName ("TanName”));
driver.findElement(By.xpath("XPathLocator));
Q. 12)  How do I submit a form using Selenium?
WebElement el = driver.findElement(By.id("ElementID"));

el.submit();
Q. 13)  How to capture screenshot in Webdriver?
File file= ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(file, new File("c:\\name.png"));
Q. 14)  How do I clear content of a text box in Selenium 2.0?
WebElement el = driver.findElement(By.id("ElementID"));
el.clear();
Q. 15)  How to execute java scripts function?
JavascriptExecutor js = (JavascriptExecutor) driver;
String title = (String) js.executeScript("pass your java scripts");
Q. 15)  What is Selenese? Selenese is the language that is used to write test scripts in Selenium IDE.

Q. 15)  Which is the only browser that supports Selenium IDE to be used?
Firefox.

Q. 15)  Which is the only browser that supports Selenium IDE to be used?
Firefox.

Have Some Questions? Share with us

Leave a Comment

Your email address will not be published.

Scroll to Top