300+ TOP Selenium Webdriver Interview Questions and Answers

Q1. How To Run The Tests In Google Chrome Using Selenium Webdriver?

Sometimes, webdriver cannot launch chrome directly, so (1) we can use Desired Capabilities of WebDriver, put chrome browser application path in the code ; (2) we need to have chromedriver.exe file in the application path. Alternatively, we can manually start chrome driver service, and then launch the test in chrome. 

Q2. What Is The Difference Between Selenium 1.0 And Webdriver?

Selenium 1.0 needs Selenium RC to run a test. However, webdriver can directly launch a browser and run tests. 

Q3. How To Run The Tests In Internet Explorer Using Selenium Webdriver?

When setup a webdriver in the code, we can select InternetExplorerDriver to use ID. If we want to use of the latest and greatest features of the WebDriver “InternetExplorerDriver”, we need to download Internet Explorer Server. 

Q4. Which Of Selenium Ide Commands Not Supported In Webdriver?

It depends on the format of conversion functionality of Selenium IDE to web driver. sometimes, not all IDE script can be converted to web driver without any problem.  

Q5. How To Run Selenium 1.0 Tests In Webdriver?

We can use WebDriverBackedSelenium to run Selenium 1.0 tests in webdriver. 

WebDriver driver = new FirefoxDriver();

Selenium selenium = new WebDriverBackedSelenium(driver, “http://www.yoursite.com”);

Q6. How To Run The Tests In Firefox Using Selenium Webdriver?

In the setup method, we select FirefoxDriver for the webDriver.

Q7. When To Use Web Driver Backed Selenium?

When we have existing tests in Selenium 1.0 (RC), if we want to avoid using Selenium RC, instead we want to use web driver, we need to use web driver backed selenium. 

Q8. How To Navigate With Browser Buttons In Selenium Webdriver?

We can use web driver’s back or forward method to simulate browser’s navigation button functionality. 

Q9. What Is Implicit And Explicit Wait In Selenium Webdriver?

Explicit wait: An explicit waits is code you define to wait for a certain condition to occur before proceeding further in the code. The worst case of this is Thread.sleep(), which sets the condition to an exact time period to wait. There are some convenience methods provided that help you write code that will wait only as long as required. WebDriverWait in combination with ExpectedCondition is one way this can be accomplished.

Implicit wait : An implicit wait is to tell WebDriver to poll the DOM for a certain amount of time when trying to find an element or elements if they are not immediately available. The default setting is @Once set, the implicit wait is set for the life of the WebDriver object instance.

Q10. 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. 

Q11. How To Run The Tests Without A Browser Or With Html Unit Driver In Selenium Webdriver?

WebDriver driver = new HtmlUnitDriver();

Q12. How To Handle Multiple Windows In Selenium Webdriver?

We can use web driver’s windows handler to identify each window and use switch method to pick the window for test. 

Q13. How To Invoke An Application In Webdriver?

We can use Process to invoke application in the code using web driver.

Q14. What Are The Prerequisites To Run Selenium Webdriver?

Depending on the programming language, reference files should be added to the test solutions in C# or test projects in Java. For example, in C#, I added webdriver dlls and in Java, I added Selenium-client-driver.jar file. And also, we should have programming IDE like visual studio or eclipse to run webdriver.

Q15. What Are The Disadvantages Of Selenium Webdriver Over Selenium 1.0?

Since selenium web driver requires coding skills, QA engineers should have some knowledge of program development in Java, .Net, or other languages. 

Q16. Where To Download Selenium Webdriver?

Selenium WebDriver libraries can be download from http://www.seleniumhq.org website.

Q17. What Is Selenium Webdriver?

 WebDriver is designed to provide a simpler, more concise programming interface in addition to addressing some limitations in the Selenium-RC API. Selenium-WebDriver was developed to better support dynamic web pages where elements of a page may change without the page itself being reloaded. WebDriver’s goal is to supply a well-designed object-oriented API that provides improved support for modern advanced web-app testing problems.Selenium-WebDriver makes direct calls to the browser using each browser’s native support for automation. 

Q18. What Is Webdriver Backed Selenium?

WebDriver backed Selenium is API that enables running Selenium 1.0 tests in web driver. 

Q19. Which Are The Locators Used For Recognizing The Objects In Selenium Webdriver?

In webdriver, we can use element id, name, css, xpath, link text, partial link text and DOM to locate elements. 

Q20. How To Configure Selenium Webdriver In Eclipse?

In eclipse, I created java projects and added JUnit or TestNG classes. In the project reference, I added JUnit or TestNG jar file.  In the test class, I used webdriver in setup, test and teardown methods. Sometimes, I used webdriver in beforeclass, beforemethod, aftermethod, afterclass sections.

Q21. What Are The Advantages Of Selenium Webdriver?

Selenium WebDriver is very flexible to use with Java, .Net, Python, Ruby or html languages. QA engineers who have good coding skills can use it very effectively. 

Q22. How To Convert Selenium 1.0 Tests To Webdriver Tests?

We can use WebDriverBackedSelenium to run Selenium 1.0 tests in webdriver. 

WebDriver driver = new FirefoxDriver();

Selenium selenium = new WebDriverBackedSelenium(driver, “http://www.yoursite.com”);

Q23. Which Version Of Selenium Ide Supports Webdriver?

Any version higher than 2.0 supports webdriver.